vona-module-test-vona 5.0.11 → 5.0.13
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/.metadata/index.d.ts +551 -0
- package/dist/.metadata/index.js +109 -0
- package/dist/.metadata/this.d.ts +2 -0
- package/dist/.metadata/this.js +2 -0
- package/dist/bean/aop.regExp.d.ts +7 -0
- package/dist/bean/aop.regExp.js +35 -0
- package/dist/bean/aop.simple.d.ts +14 -0
- package/dist/bean/aop.simple.js +59 -0
- package/dist/bean/aopMethod.test.d.ts +13 -0
- package/dist/bean/aopMethod.test.js +42 -0
- package/dist/bean/bean.testCtx.d.ts +21 -0
- package/dist/bean/bean.testCtx.js +54 -0
- package/dist/bean/broadcast.test.d.ts +8 -0
- package/dist/bean/broadcast.test.js +23 -0
- package/dist/bean/cacheMem.test.d.ts +5 -0
- package/dist/bean/cacheMem.test.js +13 -0
- package/dist/bean/cacheRedis.test.d.ts +5 -0
- package/dist/bean/cacheRedis.test.js +13 -0
- package/dist/bean/event.helloEcho.d.ts +7 -0
- package/dist/bean/event.helloEcho.js +13 -0
- package/dist/bean/eventListener.helloEcho.d.ts +9 -0
- package/dist/bean/eventListener.helloEcho.js +19 -0
- package/dist/bean/meta.version.d.ts +5 -0
- package/dist/bean/meta.version.js +25 -0
- package/dist/bean/queue.test.d.ts +10 -0
- package/dist/bean/queue.test.js +16 -0
- package/dist/bean/schedule.test.d.ts +5 -0
- package/dist/bean/schedule.test.js +17 -0
- package/dist/bean/schedule.test3.d.ts +5 -0
- package/dist/bean/schedule.test3.js +17 -0
- package/dist/bean/summerCache.test.d.ts +12 -0
- package/dist/bean/summerCache.test.js +28 -0
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +3 -0
- package/dist/config/locale/en-us.d.ts +12 -0
- package/dist/config/locale/en-us.js +11 -0
- package/dist/config/locale/zh-cn.d.ts +10 -0
- package/dist/config/locale/zh-cn.js +9 -0
- package/dist/controller/bean.d.ts +8 -0
- package/dist/controller/bean.js +93 -0
- package/dist/controller/cacheMem.d.ts +7 -0
- package/dist/controller/cacheMem.js +60 -0
- package/dist/controller/cacheRedis.d.ts +7 -0
- package/dist/controller/cacheRedis.js +60 -0
- package/dist/controller/onion.d.ts +15 -0
- package/dist/controller/onion.js +132 -0
- package/dist/controller/passport.d.ts +16 -0
- package/dist/controller/passport.js +82 -0
- package/dist/controller/performAction.d.ts +10 -0
- package/dist/controller/performAction.js +35 -0
- package/dist/controller/queue.d.ts +8 -0
- package/dist/controller/queue.js +42 -0
- package/dist/controller/summer.d.ts +7 -0
- package/dist/controller/summer.js +120 -0
- package/dist/controller/tail.d.ts +7 -0
- package/dist/controller/tail.js +43 -0
- package/dist/controller/transaction.d.ts +8 -0
- package/dist/controller/transaction.js +51 -0
- package/dist/controller/upload.d.ts +10 -0
- package/dist/controller/upload.js +80 -0
- package/dist/dto/profile.d.ts +7 -0
- package/dist/dto/profile.js +27 -0
- package/dist/dto/user.d.ts +10 -0
- package/dist/dto/user.js +33 -0
- package/dist/entity/test.d.ts +8 -0
- package/dist/entity/test.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/model/test.d.ts +4 -0
- package/dist/model/test.js +14 -0
- package/dist/service/aopMethod.d.ts +12 -0
- package/dist/service/aopMethod.js +63 -0
- package/dist/service/test.d.ts +4 -0
- package/dist/service/test.js +17 -0
- package/dist/service/testApp.d.ts +5 -0
- package/dist/service/testApp.js +20 -0
- package/dist/service/testClass.d.ts +8 -0
- package/dist/service/testClass.js +22 -0
- package/dist/service/transaction.d.ts +5 -0
- package/dist/service/transaction.js +39 -0
- package/package.json +7 -3
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import assert from 'node:assert';
|
|
11
|
+
import { sleep } from '@cabloy/utils';
|
|
12
|
+
import { BeanBase, retry } from 'vona';
|
|
13
|
+
import { Api } from 'vona-module-a-openapi';
|
|
14
|
+
import { Passport } from 'vona-module-a-user';
|
|
15
|
+
import { Controller, Web } from 'vona-module-a-web';
|
|
16
|
+
import { __ThisModule__ } from "../.metadata/this.js";
|
|
17
|
+
let ControllerSummer = class ControllerSummer extends BeanBase {
|
|
18
|
+
async test() {
|
|
19
|
+
// name
|
|
20
|
+
const name = 'test';
|
|
21
|
+
const key1 = { id: 1 };
|
|
22
|
+
const key2 = { id: 2 };
|
|
23
|
+
const key3 = { id: 3 };
|
|
24
|
+
// getCache
|
|
25
|
+
const cache = this.scope.summerCache.test;
|
|
26
|
+
assert.equal(!!cache, true);
|
|
27
|
+
let cacheOtherModule = this.$scope.testVona.summerCache.test;
|
|
28
|
+
assert.equal(cache, cacheOtherModule);
|
|
29
|
+
cacheOtherModule = this.bean.summer.cache(`${__ThisModule__}.summerCache.${name}`);
|
|
30
|
+
assert.equal(cache, cacheOtherModule);
|
|
31
|
+
let value;
|
|
32
|
+
let values;
|
|
33
|
+
// get: peek
|
|
34
|
+
value = await cache.peek(key1);
|
|
35
|
+
assert.equal(value, undefined);
|
|
36
|
+
// get
|
|
37
|
+
value = await cache.get(key1);
|
|
38
|
+
assert.equal(value.id, key1.id);
|
|
39
|
+
// get: peek
|
|
40
|
+
value = await cache.peek(key1);
|
|
41
|
+
assert.equal(value.id, key1.id);
|
|
42
|
+
value = await cache.peek(key1, { mode: 'mem' });
|
|
43
|
+
assert.equal(value.id, key1.id);
|
|
44
|
+
value = await cache.peek(key1, { mode: 'redis' });
|
|
45
|
+
assert.equal(value.id, key1.id);
|
|
46
|
+
// get: peek sleep for mem stale
|
|
47
|
+
await sleep(900);
|
|
48
|
+
// get: peek again
|
|
49
|
+
value = await cache.peek(key1, { mode: 'redis' });
|
|
50
|
+
assert.equal(value.id, key1.id);
|
|
51
|
+
await retry({ retries: 3 }, async () => {
|
|
52
|
+
await sleep(100);
|
|
53
|
+
value = await cache.peek(key1, { mode: 'mem' });
|
|
54
|
+
assert.equal(value, undefined);
|
|
55
|
+
});
|
|
56
|
+
// get: peek sleep for redis stale
|
|
57
|
+
await sleep(1900);
|
|
58
|
+
// get: peek again
|
|
59
|
+
await retry({ retries: 3 }, async () => {
|
|
60
|
+
await sleep(100);
|
|
61
|
+
value = await cache.peek(key1, { mode: 'redis' });
|
|
62
|
+
assert.equal(value, undefined);
|
|
63
|
+
});
|
|
64
|
+
value = await cache.peek(key1, { mode: 'mem' });
|
|
65
|
+
assert.equal(value, undefined);
|
|
66
|
+
// mget
|
|
67
|
+
// mem cache graph: key1
|
|
68
|
+
value = await cache.get(key1);
|
|
69
|
+
assert.equal(value.id, key1.id);
|
|
70
|
+
// mem cache graph: key2 key3
|
|
71
|
+
values = await cache.mget([key1, key2, key3]); // todo: maybe has bug
|
|
72
|
+
assert.equal(values[0].id, key1.id); // todo: maybe has bug
|
|
73
|
+
assert.equal(values[1].id, key2.id);
|
|
74
|
+
assert.equal(values[2].id, key3.id);
|
|
75
|
+
// mem cache graph: key3 key1
|
|
76
|
+
values = await cache.mget([key1, key2, key3]);
|
|
77
|
+
assert.equal(values[0].id, key1.id);
|
|
78
|
+
assert.equal(values[1].id, key2.id);
|
|
79
|
+
assert.equal(values[2].id, key3.id);
|
|
80
|
+
// mget: peek
|
|
81
|
+
value = await cache.peek(key2, { mode: 'redis' });
|
|
82
|
+
assert.equal(value.id, key2.id);
|
|
83
|
+
value = await cache.peek(key2, { mode: 'mem' });
|
|
84
|
+
assert.equal(value, undefined);
|
|
85
|
+
// del
|
|
86
|
+
await cache.del(key1);
|
|
87
|
+
await cache.del(key2);
|
|
88
|
+
// mdel
|
|
89
|
+
await cache.mdel([key1, key2, key3]);
|
|
90
|
+
// mdel: peek
|
|
91
|
+
value = await cache.peek(key3, { mode: 'redis' });
|
|
92
|
+
assert.equal(value, undefined);
|
|
93
|
+
value = await cache.peek(key3, { mode: 'mem' });
|
|
94
|
+
assert.equal(value, undefined);
|
|
95
|
+
// clear
|
|
96
|
+
values = await cache.mget([key1, key2, key3]);
|
|
97
|
+
assert.equal(values[2].id, key3.id);
|
|
98
|
+
value = await cache.peek(key3, { mode: 'redis' });
|
|
99
|
+
assert.equal(value.id, key3.id);
|
|
100
|
+
value = await cache.peek(key3, { mode: 'mem' });
|
|
101
|
+
assert.equal(value.id, key3.id);
|
|
102
|
+
await cache.clear();
|
|
103
|
+
value = await cache.peek(key3, { mode: 'redis' });
|
|
104
|
+
assert.equal(value, undefined);
|
|
105
|
+
value = await cache.peek(key3, { mode: 'mem' });
|
|
106
|
+
assert.equal(value, undefined);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
__decorate([
|
|
110
|
+
Web.post(),
|
|
111
|
+
Passport.public(),
|
|
112
|
+
__metadata("design:type", Function),
|
|
113
|
+
__metadata("design:paramtypes", []),
|
|
114
|
+
__metadata("design:returntype", Promise)
|
|
115
|
+
], ControllerSummer.prototype, "test", null);
|
|
116
|
+
ControllerSummer = __decorate([
|
|
117
|
+
Controller({ path: 'summer', meta: { mode: 'test' } }),
|
|
118
|
+
Api.exclude()
|
|
119
|
+
], ControllerSummer);
|
|
120
|
+
export { ControllerSummer };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import assert from 'node:assert';
|
|
11
|
+
import { BeanBase, cast } from 'vona';
|
|
12
|
+
import { Api } from 'vona-module-a-openapi';
|
|
13
|
+
import { Passport } from 'vona-module-a-user';
|
|
14
|
+
import { Controller, Web } from 'vona-module-a-web';
|
|
15
|
+
let ControllerTail = class ControllerTail extends BeanBase {
|
|
16
|
+
tail() {
|
|
17
|
+
// 1
|
|
18
|
+
cast(this.ctx)._tail_test = 1;
|
|
19
|
+
// tail
|
|
20
|
+
this.ctx.db.commit(() => {
|
|
21
|
+
assert.equal(cast(this.ctx)._tail_test_als_caller, undefined);
|
|
22
|
+
assert.equal(cast(this.ctx)._tail_test, 2);
|
|
23
|
+
this.ctx.db.commit(() => {
|
|
24
|
+
assert.equal(cast(this.ctx)._tail_test, 3);
|
|
25
|
+
});
|
|
26
|
+
cast(this.ctx)._tail_test = 3;
|
|
27
|
+
});
|
|
28
|
+
// 2
|
|
29
|
+
cast(this.ctx)._tail_test = 2;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
__decorate([
|
|
33
|
+
Web.post(),
|
|
34
|
+
Passport.public(),
|
|
35
|
+
__metadata("design:type", Function),
|
|
36
|
+
__metadata("design:paramtypes", []),
|
|
37
|
+
__metadata("design:returntype", void 0)
|
|
38
|
+
], ControllerTail.prototype, "tail", null);
|
|
39
|
+
ControllerTail = __decorate([
|
|
40
|
+
Controller({ path: 'tail', meta: { mode: 'test' } }),
|
|
41
|
+
Api.exclude()
|
|
42
|
+
], ControllerTail);
|
|
43
|
+
export { ControllerTail };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
2
|
+
import { BeanBase } from 'vona';
|
|
3
|
+
export interface IControllerOptionsTransaction extends IDecoratorControllerOptions {
|
|
4
|
+
}
|
|
5
|
+
export declare class ControllerTransaction extends BeanBase {
|
|
6
|
+
fail(item: object): Promise<void>;
|
|
7
|
+
success(item: object): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { BeanBase } from 'vona';
|
|
14
|
+
import { Database } from 'vona-module-a-database';
|
|
15
|
+
import { Api, Arg } from 'vona-module-a-openapi';
|
|
16
|
+
import { Passport } from 'vona-module-a-user';
|
|
17
|
+
import { Controller, Web } from 'vona-module-a-web';
|
|
18
|
+
const tableNameFail = '__tempTransactionFail';
|
|
19
|
+
const tableNameSuccess = '__tempTransactionSuccess';
|
|
20
|
+
let ControllerTransaction = class ControllerTransaction extends BeanBase {
|
|
21
|
+
async fail(item) {
|
|
22
|
+
await this.app.bean.model.update(`${tableNameFail}`, item);
|
|
23
|
+
await this.app.bean.model.update(`${tableNameFail}error`, item);
|
|
24
|
+
}
|
|
25
|
+
async success(item) {
|
|
26
|
+
await this.app.bean.model.update(tableNameSuccess, item);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
__decorate([
|
|
30
|
+
Web.post('fail'),
|
|
31
|
+
Database.transaction(),
|
|
32
|
+
Passport.public(),
|
|
33
|
+
__param(0, Arg.body()),
|
|
34
|
+
__metadata("design:type", Function),
|
|
35
|
+
__metadata("design:paramtypes", [Object]),
|
|
36
|
+
__metadata("design:returntype", Promise)
|
|
37
|
+
], ControllerTransaction.prototype, "fail", null);
|
|
38
|
+
__decorate([
|
|
39
|
+
Web.post('success'),
|
|
40
|
+
Database.transaction(),
|
|
41
|
+
Passport.public(),
|
|
42
|
+
__param(0, Arg.body()),
|
|
43
|
+
__metadata("design:type", Function),
|
|
44
|
+
__metadata("design:paramtypes", [Object]),
|
|
45
|
+
__metadata("design:returntype", Promise)
|
|
46
|
+
], ControllerTransaction.prototype, "success", null);
|
|
47
|
+
ControllerTransaction = __decorate([
|
|
48
|
+
Controller({ path: 'transaction', meta: { mode: 'test' } }),
|
|
49
|
+
Api.exclude()
|
|
50
|
+
], ControllerTransaction);
|
|
51
|
+
export { ControllerTransaction };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IUploadField, IUploadFile } from 'vona-module-a-upload';
|
|
2
|
+
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
3
|
+
import { BeanBase } from 'vona';
|
|
4
|
+
export interface IControllerOptionsUpload extends IDecoratorControllerOptions {
|
|
5
|
+
}
|
|
6
|
+
export declare class ControllerUpload extends BeanBase {
|
|
7
|
+
fields(fields: IUploadField[], checkes: string[], name: string): any;
|
|
8
|
+
file(name: string, file: IUploadFile): any;
|
|
9
|
+
files(files: IUploadFile[], images: IUploadFile[], file1: IUploadFile, file2: IUploadFile): any;
|
|
10
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import assert from 'node:assert';
|
|
14
|
+
import { BeanBase } from 'vona';
|
|
15
|
+
import { Aspect } from 'vona-module-a-aspect';
|
|
16
|
+
import { Api, Arg, v } from 'vona-module-a-openapi';
|
|
17
|
+
import { SymbolUploadValue } from 'vona-module-a-upload';
|
|
18
|
+
import { Passport } from 'vona-module-a-user';
|
|
19
|
+
import { Controller, Web } from 'vona-module-a-web';
|
|
20
|
+
import { z } from 'zod';
|
|
21
|
+
let ControllerUpload = class ControllerUpload extends BeanBase {
|
|
22
|
+
fields(fields, checkes, name) {
|
|
23
|
+
assert.equal(fields.find(item => item.name === 'name')?.value, 'zhennann');
|
|
24
|
+
assert.equal(checkes.length > 0, true);
|
|
25
|
+
assert.equal(name, 'zhennann');
|
|
26
|
+
return this.ctx[SymbolUploadValue];
|
|
27
|
+
}
|
|
28
|
+
file(name, file) {
|
|
29
|
+
assert.equal(name, 'zhennann');
|
|
30
|
+
assert.equal(file.name, 'welcome');
|
|
31
|
+
return this.ctx[SymbolUploadValue];
|
|
32
|
+
}
|
|
33
|
+
files(files, images, file1, file2) {
|
|
34
|
+
assert.equal(files.find(item => item.name === 'welcome1')?.name, 'welcome1');
|
|
35
|
+
assert.equal(images.find(item => item.name === 'images')?.name, 'images');
|
|
36
|
+
assert.equal(file1.name, 'welcome1');
|
|
37
|
+
assert.equal(file2.name, 'welcome2');
|
|
38
|
+
return this.ctx[SymbolUploadValue];
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
Web.post('fields'),
|
|
43
|
+
Passport.public(),
|
|
44
|
+
Aspect.interceptor('a-upload:upload'),
|
|
45
|
+
Api.contentType('application/json'),
|
|
46
|
+
__param(0, Arg.fields()),
|
|
47
|
+
__param(1, Arg.fields('checkes', v.array(z.string()))),
|
|
48
|
+
__param(2, Arg.field('name', v.default('zhennann'), v.title('your name'))),
|
|
49
|
+
__metadata("design:type", Function),
|
|
50
|
+
__metadata("design:paramtypes", [Array, Array, String]),
|
|
51
|
+
__metadata("design:returntype", void 0)
|
|
52
|
+
], ControllerUpload.prototype, "fields", null);
|
|
53
|
+
__decorate([
|
|
54
|
+
Web.post('file'),
|
|
55
|
+
Passport.public(),
|
|
56
|
+
Aspect.interceptor('a-upload:upload'),
|
|
57
|
+
Api.contentType('application/json'),
|
|
58
|
+
__param(0, Arg.field('name', v.default('zhennann'))),
|
|
59
|
+
__param(1, Arg.file('welcome')),
|
|
60
|
+
__metadata("design:type", Function),
|
|
61
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
62
|
+
__metadata("design:returntype", void 0)
|
|
63
|
+
], ControllerUpload.prototype, "file", null);
|
|
64
|
+
__decorate([
|
|
65
|
+
Web.post('files'),
|
|
66
|
+
Passport.public(),
|
|
67
|
+
Aspect.interceptor('a-upload:upload'),
|
|
68
|
+
Api.contentType('application/json'),
|
|
69
|
+
__param(0, Arg.files(v.title('more files'))),
|
|
70
|
+
__param(1, Arg.files('images', v.title('images'))),
|
|
71
|
+
__param(2, Arg.file('welcome1', v.title('single file'))),
|
|
72
|
+
__param(3, Arg.file('welcome2')),
|
|
73
|
+
__metadata("design:type", Function),
|
|
74
|
+
__metadata("design:paramtypes", [Array, Array, Object, Object]),
|
|
75
|
+
__metadata("design:returntype", void 0)
|
|
76
|
+
], ControllerUpload.prototype, "files", null);
|
|
77
|
+
ControllerUpload = __decorate([
|
|
78
|
+
Controller({ path: 'upload', meta: { mode: ['test', 'local'] } })
|
|
79
|
+
], ControllerUpload);
|
|
80
|
+
export { ControllerUpload };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Api, v } from 'vona-module-a-openapi';
|
|
11
|
+
import { Dto } from 'vona-module-a-web';
|
|
12
|
+
let DtoProfile = class DtoProfile {
|
|
13
|
+
id;
|
|
14
|
+
email;
|
|
15
|
+
};
|
|
16
|
+
__decorate([
|
|
17
|
+
Api.field(),
|
|
18
|
+
__metadata("design:type", Number)
|
|
19
|
+
], DtoProfile.prototype, "id", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
Api.field(v.email()),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], DtoProfile.prototype, "email", void 0);
|
|
24
|
+
DtoProfile = __decorate([
|
|
25
|
+
Dto()
|
|
26
|
+
], DtoProfile);
|
|
27
|
+
export { DtoProfile };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TableIdentity } from 'vona-module-a-database';
|
|
2
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
3
|
+
import '../.metadata/index.ts';
|
|
4
|
+
export interface IDtoOptionsUser extends IDecoratorDtoOptions {
|
|
5
|
+
}
|
|
6
|
+
export declare class DtoUser {
|
|
7
|
+
id: TableIdentity;
|
|
8
|
+
name: string;
|
|
9
|
+
married: boolean;
|
|
10
|
+
}
|
package/dist/dto/user.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Api, v } from 'vona-module-a-openapi';
|
|
11
|
+
import { Dto } from 'vona-module-a-web';
|
|
12
|
+
import { $locale } from "../.metadata/index.js";
|
|
13
|
+
let DtoUser = class DtoUser {
|
|
14
|
+
id;
|
|
15
|
+
name;
|
|
16
|
+
married;
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
Api.field(v.title($locale('UserId')), v.tableIdentity()),
|
|
20
|
+
__metadata("design:type", Object)
|
|
21
|
+
], DtoUser.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
Api.field(v.min(3)),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], DtoUser.prototype, "name", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
Api.field(),
|
|
28
|
+
__metadata("design:type", Boolean)
|
|
29
|
+
], DtoUser.prototype, "married", void 0);
|
|
30
|
+
DtoUser = __decorate([
|
|
31
|
+
Dto({ openapi: { title: $locale('User') } })
|
|
32
|
+
], DtoUser);
|
|
33
|
+
export { DtoUser };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IDecoratorEntityOptions } from 'vona-module-a-database';
|
|
2
|
+
import { EntityBase } from 'vona-module-a-database';
|
|
3
|
+
export interface IEntityOptionsTest extends IDecoratorEntityOptions {
|
|
4
|
+
}
|
|
5
|
+
export declare class EntityTest extends EntityBase {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Entity, EntityBase } from 'vona-module-a-database';
|
|
11
|
+
import { Api } from 'vona-module-a-openapi';
|
|
12
|
+
let EntityTest = class EntityTest extends EntityBase {
|
|
13
|
+
title;
|
|
14
|
+
description;
|
|
15
|
+
};
|
|
16
|
+
__decorate([
|
|
17
|
+
Api.field(),
|
|
18
|
+
__metadata("design:type", String)
|
|
19
|
+
], EntityTest.prototype, "title", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
Api.field(),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], EntityTest.prototype, "description", void 0);
|
|
24
|
+
EntityTest = __decorate([
|
|
25
|
+
Entity('testVona')
|
|
26
|
+
], EntityTest);
|
|
27
|
+
export { EntityTest };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './.metadata/index.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./.metadata/index.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BeanModelBase, Model } from 'vona-module-a-database';
|
|
8
|
+
import { EntityTest } from "../entity/test.js";
|
|
9
|
+
let ModelTest = class ModelTest extends BeanModelBase {
|
|
10
|
+
};
|
|
11
|
+
ModelTest = __decorate([
|
|
12
|
+
Model({ entity: EntityTest, clientName: 'default' })
|
|
13
|
+
], ModelTest);
|
|
14
|
+
export { ModelTest };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BeanBase } from 'vona';
|
|
2
|
+
declare class ServiceAopMethodBase extends BeanBase {
|
|
3
|
+
testSyncBase(): string;
|
|
4
|
+
}
|
|
5
|
+
export declare class ServiceAopMethod extends ServiceAopMethodBase {
|
|
6
|
+
private _name;
|
|
7
|
+
testSync(): string;
|
|
8
|
+
testAsync(): Promise<string>;
|
|
9
|
+
get name(): string;
|
|
10
|
+
set name(value: string);
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { BeanBase } from 'vona';
|
|
11
|
+
import { Aspect } from 'vona-module-a-aspect';
|
|
12
|
+
import { Service } from 'vona-module-a-web';
|
|
13
|
+
class ServiceAopMethodBase extends BeanBase {
|
|
14
|
+
testSyncBase() {
|
|
15
|
+
return 'hello';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
Aspect.aopMethod('test-vona:test', { wrapper: '+' }),
|
|
20
|
+
Aspect.aopMethod('test-vona:test', { wrapper: '-' }),
|
|
21
|
+
__metadata("design:type", Function),
|
|
22
|
+
__metadata("design:paramtypes", []),
|
|
23
|
+
__metadata("design:returntype", void 0)
|
|
24
|
+
], ServiceAopMethodBase.prototype, "testSyncBase", null);
|
|
25
|
+
let ServiceAopMethod = class ServiceAopMethod extends ServiceAopMethodBase {
|
|
26
|
+
_name = '';
|
|
27
|
+
testSync() {
|
|
28
|
+
return 'hello';
|
|
29
|
+
}
|
|
30
|
+
async testAsync() {
|
|
31
|
+
return 'hello';
|
|
32
|
+
}
|
|
33
|
+
get name() {
|
|
34
|
+
return this._name;
|
|
35
|
+
}
|
|
36
|
+
set name(value) {
|
|
37
|
+
this._name = value;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
Aspect.aopMethod('test-vona:test', { wrapper: '+' }),
|
|
42
|
+
Aspect.aopMethod('test-vona:test', { wrapper: '-' }),
|
|
43
|
+
__metadata("design:type", Function),
|
|
44
|
+
__metadata("design:paramtypes", []),
|
|
45
|
+
__metadata("design:returntype", void 0)
|
|
46
|
+
], ServiceAopMethod.prototype, "testSync", null);
|
|
47
|
+
__decorate([
|
|
48
|
+
Aspect.aopMethod('test-vona:test', { wrapper: '+' }),
|
|
49
|
+
Aspect.aopMethod('test-vona:test', { wrapper: '-' }),
|
|
50
|
+
__metadata("design:type", Function),
|
|
51
|
+
__metadata("design:paramtypes", []),
|
|
52
|
+
__metadata("design:returntype", Promise)
|
|
53
|
+
], ServiceAopMethod.prototype, "testAsync", null);
|
|
54
|
+
__decorate([
|
|
55
|
+
Aspect.aopMethod('test-vona:test', { wrapper: '+' }),
|
|
56
|
+
Aspect.aopMethod('test-vona:test', { wrapper: '-' }),
|
|
57
|
+
__metadata("design:type", Object),
|
|
58
|
+
__metadata("design:paramtypes", [Object])
|
|
59
|
+
], ServiceAopMethod.prototype, "name", null);
|
|
60
|
+
ServiceAopMethod = __decorate([
|
|
61
|
+
Service()
|
|
62
|
+
], ServiceAopMethod);
|
|
63
|
+
export { ServiceAopMethod };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BeanBase } from 'vona';
|
|
8
|
+
import { Service } from 'vona-module-a-web';
|
|
9
|
+
let ServiceTest = class ServiceTest extends BeanBase {
|
|
10
|
+
get name() {
|
|
11
|
+
return 'serviceTest';
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
ServiceTest = __decorate([
|
|
15
|
+
Service()
|
|
16
|
+
], ServiceTest);
|
|
17
|
+
export { ServiceTest };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BeanBase } from 'vona';
|
|
8
|
+
import { Service } from 'vona-module-a-web';
|
|
9
|
+
let ServiceTestApp = class ServiceTestApp extends BeanBase {
|
|
10
|
+
actionSync({ a, b }) {
|
|
11
|
+
return a + b;
|
|
12
|
+
}
|
|
13
|
+
async actionAsync({ a, b }) {
|
|
14
|
+
return Promise.resolve(a + b);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
ServiceTestApp = __decorate([
|
|
18
|
+
Service()
|
|
19
|
+
], ServiceTestApp);
|
|
20
|
+
export { ServiceTestApp };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BeanBase } from 'vona';
|
|
8
|
+
import { Service } from 'vona-module-a-web';
|
|
9
|
+
class ClassBeanBase extends BeanBase {
|
|
10
|
+
actionSync({ a, b }) {
|
|
11
|
+
return a + b;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
let ServiceTestClass = class ServiceTestClass extends ClassBeanBase {
|
|
15
|
+
async actionAsync({ a, b }) {
|
|
16
|
+
return Promise.resolve(a + b);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
ServiceTestClass = __decorate([
|
|
20
|
+
Service()
|
|
21
|
+
], ServiceTestClass);
|
|
22
|
+
export { ServiceTestClass };
|