vona-module-test-vona 5.0.52 → 5.0.54
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 +82 -10
- package/dist/bean/serializerTransform.email.d.ts +10 -0
- package/dist/controller/order.d.ts +63 -2
- package/dist/controller/post.d.ts +6 -2
- package/dist/controller/serializer.d.ts +12 -0
- package/dist/dto/postAggregate.d.ts +13 -0
- package/dist/dto/postGroup.d.ts +12 -0
- package/dist/dto/serializerArray.d.ts +8 -0
- package/dist/dto/serializerLazy.d.ts +8 -0
- package/dist/dto/serializerSimple.d.ts +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +744 -467
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/serializer.d.ts +1 -0
- package/dist/service/post.d.ts +2 -2
- package/package.json +1 -1
- package/src/.metadata/index.ts +100 -10
- package/src/bean/serializerTransform.email.ts +28 -0
- package/src/controller/order.ts +12 -2
- package/src/controller/post.ts +29 -1
- package/src/controller/serializer.ts +34 -0
- package/src/dto/orderCreate.ts +1 -2
- package/src/dto/postAggregate.ts +16 -0
- package/src/dto/postGroup.ts +13 -0
- package/src/dto/serializerArray.ts +29 -0
- package/src/dto/serializerLazy.ts +32 -0
- package/src/dto/serializerSimple.ts +98 -0
- package/src/index.ts +1 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/serializer.ts +9 -0
- package/test/serializer.test.ts +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './serializer.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SensitiveEmail(): PropertyDecorator;
|
package/dist/service/post.d.ts
CHANGED
|
@@ -50,11 +50,11 @@ export declare class ServicePost extends BeanBase {
|
|
|
50
50
|
postContent: "testVonaPostContent";
|
|
51
51
|
user: "testVonaUser";
|
|
52
52
|
}>, import("vona-module-a-orm").TypeEntityTableColumnNamesOfModelSelf<ModelPost> | import("vona").TypeRecordValues<{
|
|
53
|
-
postContent: "testVonaPostContent.
|
|
53
|
+
postContent: "testVonaPostContent.content" | "testVonaPostContent.id" | "testVonaPostContent.iid" | "testVonaPostContent.createdAt" | "testVonaPostContent.updatedAt" | "testVonaPostContent.deleted" | "testVonaPostContent.postId";
|
|
54
54
|
user: "testVonaUser.name" | "testVonaUser.id" | "testVonaUser.iid" | "testVonaUser.createdAt" | "testVonaUser.updatedAt" | "testVonaUser.deleted" | "testVonaUser.age" | "testVonaUser.scores";
|
|
55
55
|
}>>[] | undefined;
|
|
56
56
|
orders?: import("vona-module-a-orm").IModelSelectParamsOrder<import("vona-module-a-orm").TypeEntityTableColumnNamesOfModelSelf<ModelPost> | import("vona").TypeRecordValues<{
|
|
57
|
-
postContent: "testVonaPostContent.
|
|
57
|
+
postContent: "testVonaPostContent.content" | "testVonaPostContent.id" | "testVonaPostContent.iid" | "testVonaPostContent.createdAt" | "testVonaPostContent.updatedAt" | "testVonaPostContent.deleted" | "testVonaPostContent.postId";
|
|
58
58
|
user: "testVonaUser.name" | "testVonaUser.id" | "testVonaUser.iid" | "testVonaUser.createdAt" | "testVonaUser.updatedAt" | "testVonaUser.deleted" | "testVonaUser.age" | "testVonaUser.scores";
|
|
59
59
|
}>>[] | undefined;
|
|
60
60
|
limit?: number;
|
package/package.json
CHANGED
package/src/.metadata/index.ts
CHANGED
|
@@ -451,7 +451,7 @@ import { SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyModelOptions } from 'von
|
|
|
451
451
|
declare module 'vona-module-test-vona' {
|
|
452
452
|
export interface IModelOptionsCategory {
|
|
453
453
|
relations: {
|
|
454
|
-
children: IModelRelationHasMany<ModelCategory, true, 'id'|'name',undefined,undefined,undefined>;
|
|
454
|
+
children: IModelRelationHasMany<ModelCategory, 'categoryIdParent', true, 'id'|'name', undefined, undefined, undefined>;
|
|
455
455
|
};
|
|
456
456
|
}
|
|
457
457
|
export interface IModelOptionsCategoryChain {
|
|
@@ -462,24 +462,24 @@ export interface IModelOptionsCategoryChain {
|
|
|
462
462
|
export interface IModelOptionsOrder {
|
|
463
463
|
relations: {
|
|
464
464
|
user: IModelRelationBelongsTo<ModelOrder, ModelUser, true, 'id'|'name'>;
|
|
465
|
-
products: IModelRelationHasMany<ModelProduct, true, 'id'|'name'|'price'|'quantity'|'amount',undefined,undefined,undefined>;
|
|
465
|
+
products: IModelRelationHasMany<ModelProduct, 'orderId', true, 'id'|'name'|'price'|'quantity'|'amount', undefined, undefined, undefined>;
|
|
466
466
|
};
|
|
467
467
|
}
|
|
468
468
|
export interface IModelOptionsOrderStats {
|
|
469
469
|
relations: {
|
|
470
|
-
productStats: IModelRelationHasMany<ModelProduct, true,
|
|
471
|
-
productsGroups: IModelRelationHasMany<ModelProduct, false, undefined,undefined,{ count?: '*' | Array<'*'>;sum?: 'amount' | Array<'amount'> },'id' | Array<'id'>>;
|
|
470
|
+
productStats: IModelRelationHasMany<ModelProduct, 'orderId', true, undefined, undefined, { count?: '*' | Array<'*'>;sum?: 'amount' | Array<'amount'> }, undefined>;
|
|
471
|
+
productsGroups: IModelRelationHasMany<ModelProduct, 'orderId', false, undefined, undefined, { count?: '*' | Array<'*'>;sum?: 'amount' | Array<'amount'> }, 'id' | Array<'id'>>;
|
|
472
472
|
};
|
|
473
473
|
}
|
|
474
474
|
export interface IModelOptionsPost {
|
|
475
475
|
relations: {
|
|
476
|
-
postContent: IModelRelationHasOne<ModelPostContent, false, 'id'|'content'>;
|
|
476
|
+
postContent: IModelRelationHasOne<ModelPostContent, 'postId', false, 'id'|'content'>;
|
|
477
477
|
user: IModelRelationBelongsTo<ModelPost, ModelUser, true, 'id'|'name'>;
|
|
478
478
|
};
|
|
479
479
|
}
|
|
480
480
|
export interface IModelOptionsPostContent {
|
|
481
481
|
relations: {
|
|
482
|
-
post: IModelRelationBelongsTo<ModelPostContent, ModelPost, false,
|
|
482
|
+
post: IModelRelationBelongsTo<ModelPostContent, ModelPost, false, undefined>;
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
485
|
export interface IModelOptionsRole {
|
|
@@ -489,19 +489,19 @@ export interface IModelOptionsRole {
|
|
|
489
489
|
}
|
|
490
490
|
export interface IModelOptionsUser {
|
|
491
491
|
relations: {
|
|
492
|
-
posts: IModelRelationHasMany<ModelPost, false, 'id'|'title',['test-vona:user',ModelPostContent],undefined,undefined>;
|
|
492
|
+
posts: IModelRelationHasMany<ModelPost, 'userId', false, 'id'|'title', ['test-vona:user',ModelPostContent], undefined, undefined>;
|
|
493
493
|
roles: IModelRelationBelongsToMany<'test-vona:roleUser', 'test-vona:role', false, 'id'|'name',undefined,undefined,undefined>;
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
export interface IModelOptionsUserStats {
|
|
497
497
|
relations: {
|
|
498
|
-
posts: IModelRelationHasMany<ModelPost, true,
|
|
499
|
-
roles: IModelRelationBelongsToMany<'test-vona:roleUser', 'test-vona:role', false,
|
|
498
|
+
posts: IModelRelationHasMany<ModelPost, 'userId', true, undefined, undefined, { count?: '*'|'title' | Array<'*'|'title'>;sum?: 'stars' | Array<'stars'> }, undefined>;
|
|
499
|
+
roles: IModelRelationBelongsToMany<'test-vona:roleUser', 'test-vona:role', false, undefined,undefined,{ count?: '*' | Array<'*'> },undefined>;
|
|
500
500
|
};
|
|
501
501
|
}
|
|
502
502
|
export interface IModelOptionsUserStatsGroup {
|
|
503
503
|
relations: {
|
|
504
|
-
posts: IModelRelationHasMany<ModelPost, true, undefined,undefined,{ count?: '*'|'title' | Array<'*'|'title'>;sum?: 'stars' | Array<'stars'> },'title' | Array<'title'>>;
|
|
504
|
+
posts: IModelRelationHasMany<ModelPost, 'userId', true, undefined, undefined, { count?: '*'|'title' | Array<'*'|'title'>;sum?: 'stars' | Array<'stars'> }, 'title' | Array<'title'>>;
|
|
505
505
|
roles: IModelRelationBelongsToMany<'test-vona:roleUser', 'test-vona:role', false, undefined,undefined,{ count?: '*' | Array<'*'> },'name' | Array<'name'>>;
|
|
506
506
|
};
|
|
507
507
|
}
|
|
@@ -1296,6 +1296,31 @@ declare module 'vona-module-test-vona' {
|
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
1298
1298
|
/** schedule: end */
|
|
1299
|
+
/** serializerTransform: begin */
|
|
1300
|
+
export * from '../bean/serializerTransform.email.ts';
|
|
1301
|
+
import type { ISerializerTransformOptionsEmail } from '../bean/serializerTransform.email.ts';
|
|
1302
|
+
import 'vona';
|
|
1303
|
+
declare module 'vona-module-a-serialization' {
|
|
1304
|
+
|
|
1305
|
+
export interface ISerializerTransformRecord {
|
|
1306
|
+
'test-vona:email': ISerializerTransformOptionsEmail;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
}
|
|
1311
|
+
declare module 'vona-module-test-vona' {
|
|
1312
|
+
|
|
1313
|
+
export interface SerializerTransformEmail {
|
|
1314
|
+
/** @internal */
|
|
1315
|
+
get scope(): ScopeModuleTestVona;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
export interface SerializerTransformEmail {
|
|
1319
|
+
get $beanFullName(): 'test-vona.serializerTransform.email';
|
|
1320
|
+
get $onionName(): 'test-vona:email';
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
/** serializerTransform: end */
|
|
1299
1324
|
/** summerCache: begin */
|
|
1300
1325
|
export * from '../bean/summerCache.test.ts';
|
|
1301
1326
|
|
|
@@ -1335,11 +1360,16 @@ export * from '../dto/orderQueryPage.ts';
|
|
|
1335
1360
|
export * from '../dto/orderResult.ts';
|
|
1336
1361
|
export * from '../dto/orderResultPage.ts';
|
|
1337
1362
|
export * from '../dto/orderUpdate.ts';
|
|
1363
|
+
export * from '../dto/postAggregate.ts';
|
|
1338
1364
|
export * from '../dto/postCreate.ts';
|
|
1365
|
+
export * from '../dto/postGroup.ts';
|
|
1339
1366
|
export * from '../dto/postQuery.ts';
|
|
1340
1367
|
export * from '../dto/postQueryRes.ts';
|
|
1341
1368
|
export * from '../dto/profile.ts';
|
|
1342
1369
|
export * from '../dto/roleLazy.ts';
|
|
1370
|
+
export * from '../dto/serializerArray.ts';
|
|
1371
|
+
export * from '../dto/serializerLazy.ts';
|
|
1372
|
+
export * from '../dto/serializerSimple.ts';
|
|
1343
1373
|
export * from '../dto/signin.ts';
|
|
1344
1374
|
export * from '../dto/user.ts';
|
|
1345
1375
|
export * from '../dto/userCreate.ts';
|
|
@@ -1352,11 +1382,16 @@ import type { IDtoOptionsOrderQueryPage } from '../dto/orderQueryPage.ts';
|
|
|
1352
1382
|
import type { IDtoOptionsOrderResult } from '../dto/orderResult.ts';
|
|
1353
1383
|
import type { IDtoOptionsOrderResultPage } from '../dto/orderResultPage.ts';
|
|
1354
1384
|
import type { IDtoOptionsOrderUpdate } from '../dto/orderUpdate.ts';
|
|
1385
|
+
import type { IDtoOptionsPostAggregate } from '../dto/postAggregate.ts';
|
|
1355
1386
|
import type { IDtoOptionsPostCreate } from '../dto/postCreate.ts';
|
|
1387
|
+
import type { IDtoOptionsPostGroup } from '../dto/postGroup.ts';
|
|
1356
1388
|
import type { IDtoOptionsPostQuery } from '../dto/postQuery.ts';
|
|
1357
1389
|
import type { IDtoOptionsPostQueryRes } from '../dto/postQueryRes.ts';
|
|
1358
1390
|
import type { IDtoOptionsProfile } from '../dto/profile.ts';
|
|
1359
1391
|
import type { IDtoOptionsRoleLazy } from '../dto/roleLazy.ts';
|
|
1392
|
+
import type { IDtoOptionsSerializerArray } from '../dto/serializerArray.ts';
|
|
1393
|
+
import type { IDtoOptionsSerializerLazy } from '../dto/serializerLazy.ts';
|
|
1394
|
+
import type { IDtoOptionsSerializerSimple } from '../dto/serializerSimple.ts';
|
|
1360
1395
|
import type { IDtoOptionsSignin } from '../dto/signin.ts';
|
|
1361
1396
|
import type { IDtoOptionsUser } from '../dto/user.ts';
|
|
1362
1397
|
import type { IDtoOptionsUserCreate } from '../dto/userCreate.ts';
|
|
@@ -1373,11 +1408,16 @@ declare module 'vona-module-a-web' {
|
|
|
1373
1408
|
'test-vona:orderResult': IDtoOptionsOrderResult;
|
|
1374
1409
|
'test-vona:orderResultPage': IDtoOptionsOrderResultPage;
|
|
1375
1410
|
'test-vona:orderUpdate': IDtoOptionsOrderUpdate;
|
|
1411
|
+
'test-vona:postAggregate': IDtoOptionsPostAggregate;
|
|
1376
1412
|
'test-vona:postCreate': IDtoOptionsPostCreate;
|
|
1413
|
+
'test-vona:postGroup': IDtoOptionsPostGroup;
|
|
1377
1414
|
'test-vona:postQuery': IDtoOptionsPostQuery;
|
|
1378
1415
|
'test-vona:postQueryRes': IDtoOptionsPostQueryRes;
|
|
1379
1416
|
'test-vona:profile': IDtoOptionsProfile;
|
|
1380
1417
|
'test-vona:roleLazy': IDtoOptionsRoleLazy;
|
|
1418
|
+
'test-vona:serializerArray': IDtoOptionsSerializerArray;
|
|
1419
|
+
'test-vona:serializerLazy': IDtoOptionsSerializerLazy;
|
|
1420
|
+
'test-vona:serializerSimple': IDtoOptionsSerializerSimple;
|
|
1381
1421
|
'test-vona:signin': IDtoOptionsSignin;
|
|
1382
1422
|
'test-vona:user': IDtoOptionsUser;
|
|
1383
1423
|
'test-vona:userCreate': IDtoOptionsUserCreate;
|
|
@@ -1399,11 +1439,16 @@ import type { DtoOrderQueryPage } from '../dto/orderQueryPage.ts';
|
|
|
1399
1439
|
import type { DtoOrderResult } from '../dto/orderResult.ts';
|
|
1400
1440
|
import type { DtoOrderResultPage } from '../dto/orderResultPage.ts';
|
|
1401
1441
|
import type { DtoOrderUpdate } from '../dto/orderUpdate.ts';
|
|
1442
|
+
import type { DtoPostAggregate } from '../dto/postAggregate.ts';
|
|
1402
1443
|
import type { DtoPostCreate } from '../dto/postCreate.ts';
|
|
1444
|
+
import type { DtoPostGroup } from '../dto/postGroup.ts';
|
|
1403
1445
|
import type { DtoPostQuery } from '../dto/postQuery.ts';
|
|
1404
1446
|
import type { DtoPostQueryRes } from '../dto/postQueryRes.ts';
|
|
1405
1447
|
import type { DtoProfile } from '../dto/profile.ts';
|
|
1406
1448
|
import type { DtoRoleLazy } from '../dto/roleLazy.ts';
|
|
1449
|
+
import type { DtoSerializerArray } from '../dto/serializerArray.ts';
|
|
1450
|
+
import type { DtoSerializerLazy } from '../dto/serializerLazy.ts';
|
|
1451
|
+
import type { DtoSerializerSimple } from '../dto/serializerSimple.ts';
|
|
1407
1452
|
import type { DtoSignin } from '../dto/signin.ts';
|
|
1408
1453
|
import type { DtoUser } from '../dto/user.ts';
|
|
1409
1454
|
import type { DtoUserCreate } from '../dto/userCreate.ts';
|
|
@@ -1439,10 +1484,18 @@ declare module 'vona-module-test-vona' {
|
|
|
1439
1484
|
fields?: TypeEntityOptionsFields<DtoOrderUpdate, IDtoOptionsOrderUpdate[TypeSymbolKeyFieldsMore]>;
|
|
1440
1485
|
}
|
|
1441
1486
|
|
|
1487
|
+
export interface IDtoOptionsPostAggregate {
|
|
1488
|
+
fields?: TypeEntityOptionsFields<DtoPostAggregate, IDtoOptionsPostAggregate[TypeSymbolKeyFieldsMore]>;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1442
1491
|
export interface IDtoOptionsPostCreate {
|
|
1443
1492
|
fields?: TypeEntityOptionsFields<DtoPostCreate, IDtoOptionsPostCreate[TypeSymbolKeyFieldsMore]>;
|
|
1444
1493
|
}
|
|
1445
1494
|
|
|
1495
|
+
export interface IDtoOptionsPostGroup {
|
|
1496
|
+
fields?: TypeEntityOptionsFields<DtoPostGroup, IDtoOptionsPostGroup[TypeSymbolKeyFieldsMore]>;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1446
1499
|
export interface IDtoOptionsPostQuery {
|
|
1447
1500
|
fields?: TypeEntityOptionsFields<DtoPostQuery, IDtoOptionsPostQuery[TypeSymbolKeyFieldsMore]>;
|
|
1448
1501
|
}
|
|
@@ -1459,6 +1512,18 @@ declare module 'vona-module-test-vona' {
|
|
|
1459
1512
|
fields?: TypeEntityOptionsFields<DtoRoleLazy, IDtoOptionsRoleLazy[TypeSymbolKeyFieldsMore]>;
|
|
1460
1513
|
}
|
|
1461
1514
|
|
|
1515
|
+
export interface IDtoOptionsSerializerArray {
|
|
1516
|
+
fields?: TypeEntityOptionsFields<DtoSerializerArray, IDtoOptionsSerializerArray[TypeSymbolKeyFieldsMore]>;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
export interface IDtoOptionsSerializerLazy {
|
|
1520
|
+
fields?: TypeEntityOptionsFields<DtoSerializerLazy, IDtoOptionsSerializerLazy[TypeSymbolKeyFieldsMore]>;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
export interface IDtoOptionsSerializerSimple {
|
|
1524
|
+
fields?: TypeEntityOptionsFields<DtoSerializerSimple, IDtoOptionsSerializerSimple[TypeSymbolKeyFieldsMore]>;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1462
1527
|
export interface IDtoOptionsSignin {
|
|
1463
1528
|
fields?: TypeEntityOptionsFields<DtoSignin, IDtoOptionsSignin[TypeSymbolKeyFieldsMore]>;
|
|
1464
1529
|
}
|
|
@@ -1493,6 +1558,7 @@ export * from '../controller/passport.ts';
|
|
|
1493
1558
|
export * from '../controller/performAction.ts';
|
|
1494
1559
|
export * from '../controller/post.ts';
|
|
1495
1560
|
export * from '../controller/queue.ts';
|
|
1561
|
+
export * from '../controller/serializer.ts';
|
|
1496
1562
|
export * from '../controller/summer.ts';
|
|
1497
1563
|
export * from '../controller/tail.ts';
|
|
1498
1564
|
export * from '../controller/transaction.ts';
|
|
@@ -1509,6 +1575,7 @@ import type { IControllerOptionsPassport } from '../controller/passport.ts';
|
|
|
1509
1575
|
import type { IControllerOptionsPerformAction } from '../controller/performAction.ts';
|
|
1510
1576
|
import type { IControllerOptionsPost } from '../controller/post.ts';
|
|
1511
1577
|
import type { IControllerOptionsQueue } from '../controller/queue.ts';
|
|
1578
|
+
import type { IControllerOptionsSerializer } from '../controller/serializer.ts';
|
|
1512
1579
|
import type { IControllerOptionsSummer } from '../controller/summer.ts';
|
|
1513
1580
|
import type { IControllerOptionsTail } from '../controller/tail.ts';
|
|
1514
1581
|
import type { IControllerOptionsTransaction } from '../controller/transaction.ts';
|
|
@@ -1529,6 +1596,7 @@ declare module 'vona-module-a-web' {
|
|
|
1529
1596
|
'test-vona:performAction': IControllerOptionsPerformAction;
|
|
1530
1597
|
'test-vona:post': IControllerOptionsPost;
|
|
1531
1598
|
'test-vona:queue': IControllerOptionsQueue;
|
|
1599
|
+
'test-vona:serializer': IControllerOptionsSerializer;
|
|
1532
1600
|
'test-vona:summer': IControllerOptionsSummer;
|
|
1533
1601
|
'test-vona:tail': IControllerOptionsTail;
|
|
1534
1602
|
'test-vona:transaction': IControllerOptionsTransaction;
|
|
@@ -1659,6 +1727,16 @@ declare module 'vona-module-test-vona' {
|
|
|
1659
1727
|
get $onionName(): 'test-vona:queue';
|
|
1660
1728
|
}
|
|
1661
1729
|
|
|
1730
|
+
export interface ControllerSerializer {
|
|
1731
|
+
/** @internal */
|
|
1732
|
+
get scope(): ScopeModuleTestVona;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
export interface ControllerSerializer {
|
|
1736
|
+
get $beanFullName(): 'test-vona.controller.serializer';
|
|
1737
|
+
get $onionName(): 'test-vona:serializer';
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1662
1740
|
export interface ControllerSummer {
|
|
1663
1741
|
/** @internal */
|
|
1664
1742
|
get scope(): ScopeModuleTestVona;
|
|
@@ -1726,6 +1804,8 @@ import type { ControllerPost } from '../controller/post.ts';
|
|
|
1726
1804
|
// @ts-ignore ignore
|
|
1727
1805
|
import type { ControllerQueue } from '../controller/queue.ts';
|
|
1728
1806
|
// @ts-ignore ignore
|
|
1807
|
+
import type { ControllerSerializer } from '../controller/serializer.ts';
|
|
1808
|
+
// @ts-ignore ignore
|
|
1729
1809
|
import type { ControllerSummer } from '../controller/summer.ts';
|
|
1730
1810
|
// @ts-ignore ignore
|
|
1731
1811
|
import type { ControllerTail } from '../controller/tail.ts';
|
|
@@ -1783,6 +1863,10 @@ declare module 'vona-module-test-vona' {
|
|
|
1783
1863
|
actions?: TypeControllerOptionsActions<ControllerQueue>;
|
|
1784
1864
|
}
|
|
1785
1865
|
|
|
1866
|
+
export interface IControllerOptionsSerializer {
|
|
1867
|
+
actions?: TypeControllerOptionsActions<ControllerSerializer>;
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1786
1870
|
export interface IControllerOptionsSummer {
|
|
1787
1871
|
actions?: TypeControllerOptionsActions<ControllerSummer>;
|
|
1788
1872
|
}
|
|
@@ -1821,6 +1905,8 @@ declare module 'vona-module-a-web' {
|
|
|
1821
1905
|
'/test/vona/order/findMany': undefined;
|
|
1822
1906
|
'/test/vona/passport/echo/:name': undefined;
|
|
1823
1907
|
'/test/vona/passport/isAuthenticated': undefined;
|
|
1908
|
+
'/test/vona/post/group': undefined;
|
|
1909
|
+
'/test/vona/post/aggregate': undefined;
|
|
1824
1910
|
'/test/vona/post/findManyEcho': undefined;
|
|
1825
1911
|
'/test/vona/post/findMany': undefined;
|
|
1826
1912
|
}
|
|
@@ -1833,12 +1919,16 @@ export interface IApiPathPostRecord{
|
|
|
1833
1919
|
'/test/vona/onion/echo2/:userId/:userName': undefined;
|
|
1834
1920
|
'/test/vona/onion/echo4': undefined;
|
|
1835
1921
|
'/test/vona/order/create': undefined;
|
|
1922
|
+
'/test/vona/order/update/:id': undefined;
|
|
1836
1923
|
'/test/vona/passport/login': undefined;
|
|
1837
1924
|
'/test/vona/passport/refresh': undefined;
|
|
1838
1925
|
'/test/vona/passport/logout': undefined;
|
|
1839
1926
|
'/test/vona/performAction/echo': undefined;
|
|
1840
1927
|
'/test/vona/queue/pushAsync': undefined;
|
|
1841
1928
|
'/test/vona/queue/push': undefined;
|
|
1929
|
+
'/test/vona/serializer/echoSimple': undefined;
|
|
1930
|
+
'/test/vona/serializer/echoArray': undefined;
|
|
1931
|
+
'/test/vona/serializer/echoLazy': undefined;
|
|
1842
1932
|
'/test/vona/summer': undefined;
|
|
1843
1933
|
'/test/vona/tail': undefined;
|
|
1844
1934
|
'/test/vona/transaction/fail': undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IDecoratorSerializerTransformOptions, ISerializerTransform } from 'vona-module-a-serialization';
|
|
2
|
+
import { BeanBase } from 'vona';
|
|
3
|
+
import { SerializerTransform } from 'vona-module-a-serialization';
|
|
4
|
+
|
|
5
|
+
export type TypeSerializerTransformEmailValue = string | undefined;
|
|
6
|
+
|
|
7
|
+
export type TypeSerializerTransformEmailData = unknown;
|
|
8
|
+
|
|
9
|
+
export type TypeSerializerTransformEmailResult = TypeSerializerTransformEmailValue;
|
|
10
|
+
|
|
11
|
+
export interface ISerializerTransformOptionsEmail extends IDecoratorSerializerTransformOptions {}
|
|
12
|
+
|
|
13
|
+
@SerializerTransform<ISerializerTransformOptionsEmail>()
|
|
14
|
+
export class SerializerTransformEmail extends BeanBase
|
|
15
|
+
implements ISerializerTransform<
|
|
16
|
+
TypeSerializerTransformEmailValue,
|
|
17
|
+
TypeSerializerTransformEmailData,
|
|
18
|
+
TypeSerializerTransformEmailResult
|
|
19
|
+
> {
|
|
20
|
+
async transform(
|
|
21
|
+
value: TypeSerializerTransformEmailValue,
|
|
22
|
+
_data: TypeSerializerTransformEmailData,
|
|
23
|
+
_options: ISerializerTransformOptionsEmail,
|
|
24
|
+
): Promise<TypeSerializerTransformEmailResult> {
|
|
25
|
+
// eslint-disable-next-line
|
|
26
|
+
return value?.replace(/(\w?)(\w+)(\w)(@\w+\.[a-z]+)/, '$1****$3$4');
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/controller/order.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
1
2
|
import type { VonaContext } from 'vona';
|
|
2
3
|
import type { IQueryParams } from 'vona-module-a-orm';
|
|
3
4
|
import type { IDecoratorControllerOptions, IPipeOptionsQueryTransformInfo } from 'vona-module-a-web';
|
|
@@ -10,6 +11,7 @@ import { DtoOrderQuery } from '../dto/orderQuery.ts';
|
|
|
10
11
|
import { DtoOrderQueryPage } from '../dto/orderQueryPage.ts';
|
|
11
12
|
import { DtoOrderResult } from '../dto/orderResult.ts';
|
|
12
13
|
import { DtoOrderResultPage } from '../dto/orderResultPage.ts';
|
|
14
|
+
import { DtoOrderUpdate } from '../dto/orderUpdate.ts';
|
|
13
15
|
|
|
14
16
|
export interface IControllerOptionsOrder extends IDecoratorControllerOptions {}
|
|
15
17
|
|
|
@@ -25,10 +27,18 @@ function myCustomQueryTransform(_ctx: VonaContext, info: IPipeOptionsQueryTransf
|
|
|
25
27
|
export class ControllerOrder extends BeanBase {
|
|
26
28
|
@Web.post('create')
|
|
27
29
|
@Api.body(DtoOrderResult)
|
|
28
|
-
async create(@Arg.body(
|
|
30
|
+
async create(@Arg.body() data: DtoOrderCreate) {
|
|
29
31
|
return await this.scope.model.order.insert(data);
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
@Web.post('update/:id')
|
|
35
|
+
async update(@Arg.param('id') id: TableIdentity, @Arg.body() data: DtoOrderUpdate) {
|
|
36
|
+
return await this.scope.model.order.update({
|
|
37
|
+
...data,
|
|
38
|
+
id,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
@Web.get('findAll')
|
|
33
43
|
@Api.body(v.array(DtoOrderResult))
|
|
34
44
|
async findAll(
|
|
@@ -46,7 +56,7 @@ export class ControllerOrder extends BeanBase {
|
|
|
46
56
|
@Api.body(DtoOrderResultPage)
|
|
47
57
|
async findMany(
|
|
48
58
|
@Arg.queryPro(DtoOrderQueryPage) params: IQueryParams<ModelOrder>,
|
|
49
|
-
)
|
|
59
|
+
) {
|
|
50
60
|
return this.scope.model.order.selectAndCount({
|
|
51
61
|
...params,
|
|
52
62
|
include: {
|
package/src/controller/post.ts
CHANGED
|
@@ -2,9 +2,11 @@ import type { IQueryParams } from 'vona-module-a-orm';
|
|
|
2
2
|
import type { IDecoratorControllerOptions, IPipeOptionsQueryTransformInfo } from 'vona-module-a-web';
|
|
3
3
|
import type { ModelPost } from '../model/post.ts';
|
|
4
4
|
import { BeanBase } from 'vona';
|
|
5
|
-
import { Api } from 'vona-module-a-openapi';
|
|
5
|
+
import { Api, v } from 'vona-module-a-openapi';
|
|
6
6
|
import { Passport } from 'vona-module-a-user';
|
|
7
7
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
8
|
+
import { DtoPostAggregate } from '../dto/postAggregate.ts';
|
|
9
|
+
import { DtoPostGroup } from '../dto/postGroup.ts';
|
|
8
10
|
import { DtoPostQuery } from '../dto/postQuery.ts';
|
|
9
11
|
import { DtoPostQueryRes } from '../dto/postQueryRes.ts';
|
|
10
12
|
|
|
@@ -12,6 +14,32 @@ export interface IControllerOptionsPost extends IDecoratorControllerOptions {}
|
|
|
12
14
|
|
|
13
15
|
@Controller<IControllerOptionsPost>('post', { meta: { mode: ['test', 'dev'] } })
|
|
14
16
|
export class ControllerPost extends BeanBase {
|
|
17
|
+
@Web.get('group')
|
|
18
|
+
@Api.body(v.array(DtoPostGroup))
|
|
19
|
+
async group(): Promise<DtoPostGroup[]> {
|
|
20
|
+
return await this.scope.model.post.group({
|
|
21
|
+
groups: 'userId',
|
|
22
|
+
aggrs: {
|
|
23
|
+
count: '*',
|
|
24
|
+
sum: 'stars',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Web.get('aggregate')
|
|
30
|
+
@Api.body(DtoPostAggregate)
|
|
31
|
+
async aggregate(): Promise<DtoPostAggregate> {
|
|
32
|
+
return await this.scope.model.post.aggregate({
|
|
33
|
+
aggrs: {
|
|
34
|
+
count: ['*', 'stars'],
|
|
35
|
+
sum: 'stars',
|
|
36
|
+
avg: 'stars',
|
|
37
|
+
min: 'stars',
|
|
38
|
+
max: 'stars',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
15
43
|
@Web.get('findManyEcho')
|
|
16
44
|
@Api.body(DtoPostQueryRes)
|
|
17
45
|
@Passport.public()
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
2
|
+
import { BeanBase } from 'vona';
|
|
3
|
+
import { Api, v } from 'vona-module-a-openapi';
|
|
4
|
+
import { Passport } from 'vona-module-a-user';
|
|
5
|
+
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
6
|
+
import { DtoSerializerArray } from '../dto/serializerArray.ts';
|
|
7
|
+
import { DtoSerializerLazy } from '../dto/serializerLazy.ts';
|
|
8
|
+
import { DtoSerializerSimple } from '../dto/serializerSimple.ts';
|
|
9
|
+
|
|
10
|
+
export interface IControllerOptionsSerializer extends IDecoratorControllerOptions {}
|
|
11
|
+
|
|
12
|
+
@Controller<IControllerOptionsSerializer>({ path: 'serializer', meta: { mode: ['test', 'dev'] } })
|
|
13
|
+
export class ControllerSerializer extends BeanBase {
|
|
14
|
+
@Web.post('echoSimple')
|
|
15
|
+
@Api.body(DtoSerializerSimple)
|
|
16
|
+
@Passport.public()
|
|
17
|
+
echoSimple(@Arg.body() data: DtoSerializerSimple) {
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Web.post('echoArray')
|
|
22
|
+
@Api.body(v.array(DtoSerializerArray))
|
|
23
|
+
@Passport.public()
|
|
24
|
+
echoArray(@Arg.body(v.array(DtoSerializerArray)) data: DtoSerializerArray[]) {
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Web.post('echoLazy')
|
|
29
|
+
@Api.body(DtoSerializerLazy)
|
|
30
|
+
@Passport.public()
|
|
31
|
+
echoLazy(@Arg.body(DtoSerializerLazy) data: DtoSerializerLazy) {
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/dto/orderCreate.ts
CHANGED
|
@@ -6,5 +6,4 @@ import { ModelOrder } from '../model/order.ts';
|
|
|
6
6
|
export interface IDtoOptionsOrderCreate extends IDecoratorDtoOptions {}
|
|
7
7
|
|
|
8
8
|
@Dto<IDtoOptionsOrderCreate>()
|
|
9
|
-
export class DtoOrderCreate
|
|
10
|
-
extends $Dto.create(() => ModelOrder, { columns: ['orderNo', 'remark'] }) {}
|
|
9
|
+
export class DtoOrderCreate extends $Dto.create(() => ModelOrder, { columns: ['orderNo', 'remark'] }) {}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
3
|
+
import { Dto } from 'vona-module-a-web';
|
|
4
|
+
import { ModelPost } from '../model/post.ts';
|
|
5
|
+
|
|
6
|
+
export interface IDtoOptionsPostAggregate extends IDecoratorDtoOptions {}
|
|
7
|
+
|
|
8
|
+
@Dto<IDtoOptionsPostAggregate>()
|
|
9
|
+
export class DtoPostAggregate
|
|
10
|
+
extends $Dto.aggregate(() => ModelPost, {
|
|
11
|
+
count: ['*', 'stars'],
|
|
12
|
+
sum: 'stars',
|
|
13
|
+
avg: 'stars',
|
|
14
|
+
min: 'stars',
|
|
15
|
+
max: 'stars',
|
|
16
|
+
}) {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
3
|
+
import { Dto } from 'vona-module-a-web';
|
|
4
|
+
import { ModelPost } from '../model/post.ts';
|
|
5
|
+
|
|
6
|
+
export interface IDtoOptionsPostGroup extends IDecoratorDtoOptions {}
|
|
7
|
+
|
|
8
|
+
@Dto<IDtoOptionsPostGroup>()
|
|
9
|
+
export class DtoPostGroup
|
|
10
|
+
extends $Dto.group(() => ModelPost, 'userId', {
|
|
11
|
+
count: '*',
|
|
12
|
+
sum: 'stars',
|
|
13
|
+
}) {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
import { Api, v } from 'vona-module-a-openapi';
|
|
3
|
+
import { Dto } from 'vona-module-a-web';
|
|
4
|
+
import { DtoSerializerSimple } from './serializerSimple.ts';
|
|
5
|
+
|
|
6
|
+
export interface IDtoOptionsSerializerArray extends IDecoratorDtoOptions {}
|
|
7
|
+
|
|
8
|
+
@Dto<IDtoOptionsSerializerArray>()
|
|
9
|
+
export class DtoSerializerArray {
|
|
10
|
+
@Api.field(v.serializerGetter((value: DtoSerializerSimple[], _data: DtoSerializerArray) => {
|
|
11
|
+
return value.map(item => {
|
|
12
|
+
return {
|
|
13
|
+
...item,
|
|
14
|
+
password: '111111',
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}), v.title('Simple'), v.array(DtoSerializerSimple))
|
|
18
|
+
simples: DtoSerializerSimple[];
|
|
19
|
+
|
|
20
|
+
@Api.field(v.serializerGetter((value: DtoSerializerSimple[], _data: DtoSerializerArray) => {
|
|
21
|
+
return value.map(item => {
|
|
22
|
+
return {
|
|
23
|
+
...item,
|
|
24
|
+
password: '111111',
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}), v.title('Simple'), v.array(v.lazy(() => DtoSerializerSimple)))
|
|
28
|
+
simplesLazy: DtoSerializerSimple[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
import { Api, v } from 'vona-module-a-openapi';
|
|
3
|
+
import { Dto } from 'vona-module-a-web';
|
|
4
|
+
import { DtoSerializerSimple } from './serializerSimple.ts';
|
|
5
|
+
|
|
6
|
+
export interface IDtoOptionsSerializerLazy extends IDecoratorDtoOptions {}
|
|
7
|
+
|
|
8
|
+
@Dto<IDtoOptionsSerializerLazy>()
|
|
9
|
+
export class DtoSerializerLazy {
|
|
10
|
+
@Api.field(
|
|
11
|
+
v.serializerGetter((value: DtoSerializerSimple) => {
|
|
12
|
+
return { ...value, password: '111111' };
|
|
13
|
+
}),
|
|
14
|
+
v.object(DtoSerializerSimple),
|
|
15
|
+
)
|
|
16
|
+
simple: DtoSerializerSimple;
|
|
17
|
+
|
|
18
|
+
@Api.field(
|
|
19
|
+
v.serializerGetter((value: DtoSerializerSimple) => {
|
|
20
|
+
return { ...value, password: '111111' };
|
|
21
|
+
}),
|
|
22
|
+
v.title('title'),
|
|
23
|
+
v.optional(),
|
|
24
|
+
v.lazy(
|
|
25
|
+
v.description('description'),
|
|
26
|
+
() => {
|
|
27
|
+
return DtoSerializerSimple;
|
|
28
|
+
},
|
|
29
|
+
),
|
|
30
|
+
)
|
|
31
|
+
simpleLazy: DtoSerializerSimple;
|
|
32
|
+
}
|