cabloy 5.1.20 → 5.1.21
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/package.json +1 -1
- package/scripts/upgrade.ts +13 -4
- package/vona/pnpm-lock.yaml +60 -58
- package/vona/src/suite-vendor/a-auth/tsconfig.json +0 -3
- package/vona/src/suite-vendor/a-cabloy/tsconfig.json +0 -9
- package/vona/src/suite-vendor/a-captcha/tsconfig.json +0 -3
- package/vona/src/suite-vendor/a-vona/tsconfig.json +0 -3
- package/vona/src/suite-vendor/a-auth/modules/test-auth/package.json +0 -52
- package/vona/src/suite-vendor/a-auth/modules/test-auth/src/.metadata/index.ts +0 -74
- package/vona/src/suite-vendor/a-auth/modules/test-auth/src/.metadata/this.ts +0 -2
- package/vona/src/suite-vendor/a-auth/modules/test-auth/src/controller/passport.ts +0 -19
- package/vona/src/suite-vendor/a-auth/modules/test-auth/src/index.ts +0 -1
- package/vona/src/suite-vendor/a-auth/modules/test-auth/test/authOauth.test.ts +0 -55
- package/vona/src/suite-vendor/a-auth/modules/test-auth/test/authSimple.test.ts +0 -52
- package/vona/src/suite-vendor/a-auth/modules/test-auth/tsconfig.build.json +0 -11
- package/vona/src/suite-vendor/a-auth/modules/test-auth/tsconfig.json +0 -7
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/package.json +0 -60
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/src/.metadata/index.ts +0 -103
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/src/.metadata/this.ts +0 -2
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/src/bean/meta.status.ts +0 -15
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/src/controller/status.ts +0 -44
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/src/index.ts +0 -1
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/test/datasource.test.ts +0 -51
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/test/socket.test.ts +0 -48
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/test/status.test.ts +0 -10
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/tsconfig.build.json +0 -11
- package/vona/src/suite-vendor/a-cabloy/modules/test-cabloy/tsconfig.json +0 -7
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/package.json +0 -63
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/.metadata/index.ts +0 -377
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/.metadata/locales.ts +0 -18
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/.metadata/this.ts +0 -2
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/bean/meta.version.ts +0 -49
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/bean/ssrMenu.product.ts +0 -26
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/config/locale/en-us.ts +0 -15
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/config/locale/zh-cn.ts +0 -15
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/controller/product.tsx +0 -64
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/dto/productCreate.tsx +0 -40
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/dto/productSelectReq.tsx +0 -25
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/dto/productSelectRes.tsx +0 -11
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/dto/productSelectResItem.tsx +0 -39
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/dto/productUpdate.tsx +0 -30
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/dto/productView.tsx +0 -25
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/entity/product.tsx +0 -65
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/index.ts +0 -2
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/model/product.ts +0 -10
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/src/service/product.ts +0 -37
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/test/permission.test.ts +0 -19
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/test/product.test.ts +0 -65
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/tsconfig.build.json +0 -11
- package/vona/src/suite-vendor/a-cabloy/modules/test-rest/tsconfig.json +0 -7
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/package.json +0 -60
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/.metadata/index.ts +0 -161
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/.metadata/locales.ts +0 -18
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/.metadata/this.ts +0 -2
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/config/locale/en-us.ts +0 -13
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/config/locale/zh-cn.ts +0 -11
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/controller/toolOne.ts +0 -43
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/controller/toolTwo.ts +0 -37
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/dto/testBody.ts +0 -10
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/dto/testDetail.ts +0 -21
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/dto/testParams.ts +0 -13
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/dto/testQuery.ts +0 -12
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/dto/testResult.tsx +0 -159
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/src/index.ts +0 -2
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/tsconfig.build.json +0 -11
- package/vona/src/suite-vendor/a-cabloy/modules/test-ssr/tsconfig.json +0 -7
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/package.json +0 -52
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/src/.metadata/index.ts +0 -99
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/src/.metadata/this.ts +0 -2
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/src/controller/captcha.ts +0 -18
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/src/dto/signin.ts +0 -20
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/src/index.ts +0 -1
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/test/captcha.test.ts +0 -148
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/tsconfig.build.json +0 -11
- package/vona/src/suite-vendor/a-captcha/modules/test-captcha/tsconfig.json +0 -7
- package/vona/src/suite-vendor/a-vona/modules/test-vona/assets/img/vona.png +0 -0
- package/vona/src/suite-vendor/a-vona/modules/test-vona/assets/static/img/vona.png +0 -0
- package/vona/src/suite-vendor/a-vona/modules/test-vona/assets/static/img/vona.svg +0 -3
- package/vona/src/suite-vendor/a-vona/modules/test-vona/package.json +0 -61
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/.metadata/index.ts +0 -2181
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/.metadata/locales.ts +0 -18
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/.metadata/this.ts +0 -2
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/aop.regExp.ts +0 -34
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/aop.simple.ts +0 -80
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/aopMethod.test.ts +0 -63
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/bean.testCtx.ts +0 -59
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/broadcast.test.ts +0 -24
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/cacheMem.test.ts +0 -7
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/cacheRedis.post.ts +0 -11
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/cacheRedis.test.ts +0 -7
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/event.helloEcho.ts +0 -13
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/eventListener.helloEcho.ts +0 -24
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/meta.asset.ts +0 -10
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/meta.static.ts +0 -7
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/meta.version.ts +0 -108
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/queue.test.ts +0 -25
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/schedule.test.ts +0 -13
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/schedule.test3.ts +0 -13
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/serializerTransform.email.ts +0 -35
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/summerCache.caching.ts +0 -36
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/bean/summerCache.test.ts +0 -36
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/config/config.ts +0 -5
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/config/locale/en-us.ts +0 -21
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/config/locale/zh-cn.ts +0 -19
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/bean.ts +0 -103
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/cacheMem.ts +0 -64
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/cacheRedis.ts +0 -56
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/dtoTest.ts +0 -61
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/guardPassport.ts +0 -26
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/onion.ts +0 -103
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/order.ts +0 -56
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/passport.ts +0 -49
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/performAction.ts +0 -19
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/post.ts +0 -59
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/queue.ts +0 -27
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/serializer.ts +0 -40
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/summer.ts +0 -130
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/tail.ts +0 -33
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/transaction.ts +0 -30
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/controller/upload.ts +0 -61
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/categoryTree.ts +0 -9
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/orderCreate.ts +0 -13
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/orderQuery.ts +0 -25
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/orderQueryPage.ts +0 -24
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/orderSelectRes.ts +0 -11
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/orderSelectResItem.ts +0 -11
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/orderUpdate.ts +0 -13
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/postAggregate.ts +0 -17
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/postCreate.ts +0 -11
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/postGroup.ts +0 -14
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/postSelectReq.ts +0 -36
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/postSelectRes.ts +0 -11
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/postSelectResItem.tsx +0 -28
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/profile.ts +0 -15
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/roleLazy.ts +0 -17
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/serializerArray.ts +0 -39
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/serializerLazy.ts +0 -31
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/serializerSimple.ts +0 -112
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/user.ts +0 -21
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/userCreate.ts +0 -11
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/userLazy.ts +0 -20
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/dto/userUpdate.ts +0 -9
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/category.ts +0 -16
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/order.ts +0 -21
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/post.ts +0 -21
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/postContent.ts +0 -16
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/product.ts +0 -27
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/role.ts +0 -12
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/roleUser.ts +0 -16
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/test.ts +0 -24
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/entity/user.ts +0 -18
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/index.ts +0 -4
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/lib/index.ts +0 -1
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/lib/serializer.ts +0 -9
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/category.ts +0 -22
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/categoryChain.ts +0 -23
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/order.ts +0 -33
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/orderStats.ts +0 -29
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/post.ts +0 -23
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/postContent.ts +0 -23
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/product.ts +0 -10
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/role.ts +0 -23
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/roleUser.ts +0 -10
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/test.ts +0 -10
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/testDynamicTable.ts +0 -23
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/user.ts +0 -30
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/userStats.ts +0 -22
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/model/userStatsGroup.ts +0 -36
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/aopMethod.ts +0 -38
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/caching.ts +0 -89
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/category.ts +0 -153
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/order.ts +0 -67
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/post.ts +0 -280
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/product.ts +0 -5
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/test.ts +0 -9
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/testApp.ts +0 -13
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/testClass.ts +0 -15
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/testData.ts +0 -71
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/transaction.ts +0 -20
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/service/user.ts +0 -124
- package/vona/src/suite-vendor/a-vona/modules/test-vona/src/types/index.ts +0 -6
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/aopMethod.test.ts +0 -21
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/bean.test.ts +0 -16
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/broadcast.test.ts +0 -17
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/cache/cacheMem.test.ts +0 -10
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/cache/cacheRedis.test.ts +0 -10
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/cache/caching.test.ts +0 -61
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/cache/summer.test.ts +0 -10
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/database.test.ts +0 -132
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/dtoAggregate.test.ts +0 -44
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/dtoGet.test.ts +0 -82
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/dtoGroup.test.ts +0 -44
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/dtoLazy.test.ts +0 -53
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/dtoMutate.test.ts +0 -56
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/dtoQuery.test.ts +0 -70
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelAggregate.test.ts +0 -222
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelCache.test.ts +0 -37
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelGeneral.test.ts +0 -18
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelGroup.test.ts +0 -248
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelMagic.test.ts +0 -37
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelRelations.test.ts +0 -215
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelRelationsJoins.test.ts +0 -58
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelRelationsMutate.test.ts +0 -436
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelWhere.test.ts +0 -173
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/orm.test.ts +0 -22
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/transaction.test.ts +0 -142
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/event.test.ts +0 -14
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/guardPassport.test.ts +0 -48
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/instance.test.ts +0 -35
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/jwt.test.ts +0 -28
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/locale.test.ts +0 -64
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/mail.test.ts +0 -14
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/passport.test.ts +0 -69
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/queue.test.ts +0 -11
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/runtime.test.ts +0 -24
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/serializer.test.ts +0 -82
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/static.test.ts +0 -22
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/tail.test.ts +0 -21
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/upload.test.ts +0 -75
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/utils/cabloyUtils.test.ts +0 -19
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/utils/celjs.test.ts +0 -64
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/utils/mappedTypes.test.ts +0 -73
- package/vona/src/suite-vendor/a-vona/modules/test-vona/test/utils/performAction.test.ts +0 -28
- package/vona/src/suite-vendor/a-vona/modules/test-vona/tsconfig.build.json +0 -11
- package/vona/src/suite-vendor/a-vona/modules/test-vona/tsconfig.json +0 -7
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
import { describe, it } from 'node:test';
|
|
3
|
-
import { cast } from 'vona';
|
|
4
|
-
import { app } from 'vona-mock';
|
|
5
|
-
import { $relationDynamic } from 'vona-module-a-orm';
|
|
6
|
-
import { ModelPost, ModelRole, ModelRoleUser } from 'vona-module-test-vona';
|
|
7
|
-
|
|
8
|
-
describe('modelGroup.test.ts', () => {
|
|
9
|
-
it('action:modelGroup', async () => {
|
|
10
|
-
await app.bean.executor.mockCtx(async () => {
|
|
11
|
-
const prefix = 'action:modelGroup';
|
|
12
|
-
// scope
|
|
13
|
-
const scopeTest = app.scope('test-vona');
|
|
14
|
-
// insert: roles
|
|
15
|
-
const roles = await scopeTest.model.role.insertBulk([
|
|
16
|
-
{ name: `${prefix}:family` },
|
|
17
|
-
{ name: `${prefix}:friend` },
|
|
18
|
-
]);
|
|
19
|
-
assert.equal(roles.length, 2);
|
|
20
|
-
assert.equal(roles[0].id !== undefined, true);
|
|
21
|
-
// create: users
|
|
22
|
-
const users = await scopeTest.model.user.insertBulk(
|
|
23
|
-
[
|
|
24
|
-
{
|
|
25
|
-
name: `${prefix}:tom`,
|
|
26
|
-
age: 3,
|
|
27
|
-
posts: [
|
|
28
|
-
{
|
|
29
|
-
title: `${prefix}:postApple`,
|
|
30
|
-
stars: 2,
|
|
31
|
-
postContent: {
|
|
32
|
-
content: `${prefix}:postContentApple`,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
title: `${prefix}:postApple2`,
|
|
37
|
-
stars: 3,
|
|
38
|
-
postContent: {
|
|
39
|
-
content: `${prefix}:postContentApple2`,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
roles: [
|
|
44
|
-
{
|
|
45
|
-
id: roles[0].id,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: `${prefix}:jimmy`,
|
|
51
|
-
age: 5,
|
|
52
|
-
posts: [
|
|
53
|
-
{
|
|
54
|
-
title: `${prefix}:postPear`,
|
|
55
|
-
stars: 4,
|
|
56
|
-
postContent: {
|
|
57
|
-
content: `${prefix}:postContentPear`,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
{ name: `${prefix}:mike` },
|
|
63
|
-
],
|
|
64
|
-
{
|
|
65
|
-
include: {
|
|
66
|
-
posts: { include: { postContent: true } },
|
|
67
|
-
roles: true,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
);
|
|
71
|
-
// group: user
|
|
72
|
-
const usersGroup = await scopeTest.model.user.group({
|
|
73
|
-
groups: ['name'],
|
|
74
|
-
aggrs: {
|
|
75
|
-
count: ['*', 'age'],
|
|
76
|
-
sum: ['age'],
|
|
77
|
-
avg: 'age',
|
|
78
|
-
max: 'age',
|
|
79
|
-
},
|
|
80
|
-
where: {
|
|
81
|
-
name: { _startsWith_: `${prefix}:` },
|
|
82
|
-
},
|
|
83
|
-
having: {
|
|
84
|
-
_and_: {
|
|
85
|
-
name: { _startsWith_: `${prefix}:` },
|
|
86
|
-
max_age: { _isNot_: null },
|
|
87
|
-
},
|
|
88
|
-
count_all: { _gt_: 0 },
|
|
89
|
-
},
|
|
90
|
-
orders: [['max_age', 'desc']],
|
|
91
|
-
});
|
|
92
|
-
assert.equal(usersGroup.length, 2);
|
|
93
|
-
assert.equal(usersGroup[0].name, `${prefix}:jimmy`);
|
|
94
|
-
assert.equal(usersGroup[0].count_all, 1);
|
|
95
|
-
assert.equal(usersGroup[0].count_age, 1);
|
|
96
|
-
assert.equal(usersGroup[0].sum_age, 5);
|
|
97
|
-
assert.equal(usersGroup[0].avg_age, 5);
|
|
98
|
-
assert.equal(usersGroup[0].max_age, 5);
|
|
99
|
-
// group: usersStats: posts: autoload
|
|
100
|
-
const usersStats = await scopeTest.model.userStatsGroup.select({
|
|
101
|
-
where: {
|
|
102
|
-
id: users.map(item => item.id),
|
|
103
|
-
},
|
|
104
|
-
orders: [['id', 'asc']],
|
|
105
|
-
include: {
|
|
106
|
-
roles: true,
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
assert.equal(usersStats.length, 3);
|
|
110
|
-
assert.equal(usersStats[0].posts[0].title, `${prefix}:postApple2`);
|
|
111
|
-
assert.equal(usersStats[0].posts[0].count_all, 1);
|
|
112
|
-
assert.equal(usersStats[0].posts[0].count_title, 1);
|
|
113
|
-
assert.equal(usersStats[0].posts[0].sum_stars, 3);
|
|
114
|
-
assert.equal(usersStats[0].roles[0].count_all, 1);
|
|
115
|
-
// group: usersStats: posts: mixed
|
|
116
|
-
const usersStats2 = await scopeTest.model.userStatsGroup.select({
|
|
117
|
-
where: {
|
|
118
|
-
id: users.map(item => item.id),
|
|
119
|
-
},
|
|
120
|
-
orders: [['id', 'asc']],
|
|
121
|
-
include: {
|
|
122
|
-
posts: { aggrs: { count: '*' } },
|
|
123
|
-
roles: true,
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
assert.equal(usersStats2.length, 3);
|
|
127
|
-
assert.equal(usersStats2[0].posts[0].title, `${prefix}:postApple2`);
|
|
128
|
-
assert.equal(usersStats2[0].posts[0].count_all, 1);
|
|
129
|
-
assert.equal(cast(usersStats2[0].posts[0]).count_title, undefined);
|
|
130
|
-
assert.equal(usersStats2[0].posts[0].sum_stars, 3);
|
|
131
|
-
assert.equal(usersStats2[0].roles[0].count_all, 1);
|
|
132
|
-
// group: usersStats: posts: disable
|
|
133
|
-
const usersStats3 = await scopeTest.model.userStatsGroup.select({
|
|
134
|
-
where: {
|
|
135
|
-
id: users.map(item => item.id),
|
|
136
|
-
},
|
|
137
|
-
orders: [['id', 'asc']],
|
|
138
|
-
include: {
|
|
139
|
-
posts: {
|
|
140
|
-
aggrs: {
|
|
141
|
-
count: ['*'],
|
|
142
|
-
sum: [],
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
roles: true,
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
assert.equal(usersStats3.length, 3);
|
|
149
|
-
assert.equal(usersStats3[0].posts[0].title, `${prefix}:postApple2`);
|
|
150
|
-
assert.equal(usersStats3[0].posts[0].count_all, 1);
|
|
151
|
-
assert.equal(cast(usersStats3[0].posts[0]).count_title, undefined);
|
|
152
|
-
assert.equal(cast(usersStats3[0].posts[0]).sum_stars, undefined);
|
|
153
|
-
assert.equal(usersStats3[0].roles[0].count_all, 1);
|
|
154
|
-
// group: usersStats: with
|
|
155
|
-
const usersStats4 = await scopeTest.model.userStatsGroup.select({
|
|
156
|
-
where: {
|
|
157
|
-
id: users.map(item => item.id),
|
|
158
|
-
},
|
|
159
|
-
orders: [['id', 'asc']],
|
|
160
|
-
include: {
|
|
161
|
-
posts: false,
|
|
162
|
-
roles: false,
|
|
163
|
-
},
|
|
164
|
-
with: {
|
|
165
|
-
posts: $relationDynamic.hasMany(
|
|
166
|
-
() => ModelPost,
|
|
167
|
-
'userId',
|
|
168
|
-
{
|
|
169
|
-
groups: ['title'],
|
|
170
|
-
aggrs: { count: '*' },
|
|
171
|
-
orders: [['title', 'desc']],
|
|
172
|
-
},
|
|
173
|
-
undefined,
|
|
174
|
-
true,
|
|
175
|
-
),
|
|
176
|
-
roles: $relationDynamic.belongsToMany(
|
|
177
|
-
() => ModelRoleUser,
|
|
178
|
-
() => ModelRole,
|
|
179
|
-
'userId',
|
|
180
|
-
'roleId',
|
|
181
|
-
{
|
|
182
|
-
groups: 'name',
|
|
183
|
-
aggrs: { count: '*' },
|
|
184
|
-
},
|
|
185
|
-
),
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
assert.equal(usersStats4.length, 3);
|
|
189
|
-
assert.equal(usersStats4[0].posts[0].title, `${prefix}:postApple2`);
|
|
190
|
-
assert.equal(usersStats4[0].posts[0].count_all, 1);
|
|
191
|
-
assert.equal(cast(usersStats4[0].posts[0]).count_title, undefined);
|
|
192
|
-
assert.equal(cast(usersStats4[0].posts[0]).sum_stars, undefined);
|
|
193
|
-
assert.equal(usersStats4[0].roles[0].count_all, 1);
|
|
194
|
-
// group: get
|
|
195
|
-
const userStats4 = await scopeTest.model.userStatsGroup.get(
|
|
196
|
-
{
|
|
197
|
-
id: users[0].id,
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
include: {
|
|
201
|
-
posts: false,
|
|
202
|
-
roles: false,
|
|
203
|
-
},
|
|
204
|
-
with: {
|
|
205
|
-
posts: $relationDynamic.hasMany(
|
|
206
|
-
() => ModelPost,
|
|
207
|
-
'userId',
|
|
208
|
-
{
|
|
209
|
-
groups: ['title'],
|
|
210
|
-
aggrs: { count: '*' },
|
|
211
|
-
orders: [['title', 'desc']],
|
|
212
|
-
},
|
|
213
|
-
undefined,
|
|
214
|
-
true,
|
|
215
|
-
),
|
|
216
|
-
roles: $relationDynamic.belongsToMany(
|
|
217
|
-
() => ModelRoleUser,
|
|
218
|
-
() => ModelRole,
|
|
219
|
-
'userId',
|
|
220
|
-
'roleId',
|
|
221
|
-
{
|
|
222
|
-
groups: 'name',
|
|
223
|
-
aggrs: { count: '*' },
|
|
224
|
-
},
|
|
225
|
-
),
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
);
|
|
229
|
-
assert.equal(userStats4?.posts[0].title, `${prefix}:postApple2`);
|
|
230
|
-
assert.equal(userStats4?.posts[0].count_all, 1);
|
|
231
|
-
assert.equal(cast(userStats4?.posts[0]).count_title, undefined);
|
|
232
|
-
assert.equal(cast(userStats4?.posts[0]).sum_stars, undefined);
|
|
233
|
-
assert.equal(userStats4?.roles[0].count_all, 1);
|
|
234
|
-
// delete: users
|
|
235
|
-
await scopeTest.model.user.deleteBulk(
|
|
236
|
-
users.map(item => item.id),
|
|
237
|
-
{
|
|
238
|
-
include: {
|
|
239
|
-
posts: { include: { postContent: true } },
|
|
240
|
-
roles: true,
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
);
|
|
244
|
-
// delete: roles
|
|
245
|
-
await scopeTest.model.role.deleteBulk(roles.map(item => item.id));
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
import { describe, it } from 'node:test';
|
|
3
|
-
import { app } from 'vona-mock';
|
|
4
|
-
|
|
5
|
-
describe('modelMagic.test.ts', () => {
|
|
6
|
-
it('action:modelMagic', async () => {
|
|
7
|
-
await app.bean.executor.mockCtx(async () => {
|
|
8
|
-
const name = 'modelMagic:001';
|
|
9
|
-
// scope
|
|
10
|
-
const scopeTest = app.scope('test-vona');
|
|
11
|
-
// create
|
|
12
|
-
const item = await scopeTest.model.user.insert({ name });
|
|
13
|
-
assert.equal(item.name, name);
|
|
14
|
-
// getById
|
|
15
|
-
let user = await scopeTest.model.user.getById(item.id);
|
|
16
|
-
assert.equal(user?.name, name);
|
|
17
|
-
// getByName
|
|
18
|
-
user = await scopeTest.model.user.getByName(name);
|
|
19
|
-
assert.equal(user?.name, name);
|
|
20
|
-
user = await scopeTest.model.user.getByNameEqI(name.toUpperCase());
|
|
21
|
-
assert.equal(user?.name, name);
|
|
22
|
-
const users = await scopeTest.model.user.selectByName(name);
|
|
23
|
-
assert.equal(users[0].name, name);
|
|
24
|
-
const users2 = await scopeTest.model.user.selectByName(name, {
|
|
25
|
-
where: { id: item.id },
|
|
26
|
-
columns: ['age', 'name'],
|
|
27
|
-
});
|
|
28
|
-
assert.equal(users2[0].name, name);
|
|
29
|
-
// updateById
|
|
30
|
-
await scopeTest.model.user.updateById(item.id, { age: 18 });
|
|
31
|
-
user = await scopeTest.model.user.getById(item.id);
|
|
32
|
-
assert.equal(user?.age, 18);
|
|
33
|
-
// deleteById
|
|
34
|
-
await scopeTest.model.user.deleteById(item.id);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
import { describe, it } from 'node:test';
|
|
3
|
-
import { cast } from 'vona';
|
|
4
|
-
import { app } from 'vona-mock';
|
|
5
|
-
import { $relationDynamic } from 'vona-module-a-orm';
|
|
6
|
-
import { ModelPost, ModelPostContent, ModelUser } from 'vona-module-test-vona';
|
|
7
|
-
|
|
8
|
-
describe('modelRelations.test.ts', () => {
|
|
9
|
-
it('action:modelRelations', async () => {
|
|
10
|
-
await app.bean.executor.mockCtx(async () => {
|
|
11
|
-
const prefix = 'action:modelRelations';
|
|
12
|
-
// scope
|
|
13
|
-
const scopeTest = app.scope('test-vona');
|
|
14
|
-
// test data: create
|
|
15
|
-
const testData = await scopeTest.service.testData.create(prefix);
|
|
16
|
-
const { userTom, userJimmy, roleFamily, roleFriend, postApple, postPear, postContentApple } =
|
|
17
|
-
testData;
|
|
18
|
-
// relation: hasOne
|
|
19
|
-
const posts = await scopeTest.model.post.select({
|
|
20
|
-
columns: ['id', 'title', 'userId'],
|
|
21
|
-
where: {
|
|
22
|
-
id: [postApple.id, postPear.id],
|
|
23
|
-
},
|
|
24
|
-
orders: [['id', 'asc']],
|
|
25
|
-
include: { postContent: true },
|
|
26
|
-
});
|
|
27
|
-
assert.equal(posts.length, 2);
|
|
28
|
-
assert.equal(posts[0].postContent?.content, 'action:modelRelations:postContentApple');
|
|
29
|
-
assert.equal(cast(posts[0].postContent)?.iid, undefined);
|
|
30
|
-
assert.equal(posts[1].postContent, undefined);
|
|
31
|
-
// relation: hasOne: get
|
|
32
|
-
const postGet = await scopeTest.model.post.get(
|
|
33
|
-
{ id: postApple.id },
|
|
34
|
-
{ columns: 'id', include: { postContent: true } },
|
|
35
|
-
);
|
|
36
|
-
assert.equal(cast(postGet)?.iid, undefined);
|
|
37
|
-
assert.equal(postGet?.postContent?.content, 'action:modelRelations:postContentApple');
|
|
38
|
-
// relation: hasOne: columns
|
|
39
|
-
const postGetColumns = await scopeTest.model.post.get(
|
|
40
|
-
{ id: postApple.id },
|
|
41
|
-
{ columns: ['id'], include: { postContent: { columns: ['id'] } } },
|
|
42
|
-
);
|
|
43
|
-
assert.equal(cast(postGetColumns?.postContent)?.content, undefined);
|
|
44
|
-
assert.equal(Object.keys(postGetColumns!.postContent!).length, 1);
|
|
45
|
-
assert.equal(Object.keys(postGetColumns!).length, 1 + 2); // .user + .postContent
|
|
46
|
-
// relation: belongsTo
|
|
47
|
-
const postContents = await scopeTest.model.postContent.select({
|
|
48
|
-
where: {
|
|
49
|
-
id: postContentApple.id,
|
|
50
|
-
},
|
|
51
|
-
include: { post: true },
|
|
52
|
-
});
|
|
53
|
-
assert.equal(postContents.length, 1);
|
|
54
|
-
assert.equal(postContents[0].post?.title, 'action:modelRelations:postApple');
|
|
55
|
-
// relation: belongsTo: get
|
|
56
|
-
const postContentGet = await scopeTest.model.postContent.get(
|
|
57
|
-
{ id: postContentApple.id },
|
|
58
|
-
{ include: { post: true } },
|
|
59
|
-
);
|
|
60
|
-
assert.equal(postContentGet?.post?.title, 'action:modelRelations:postApple');
|
|
61
|
-
// relation: belongsTo: autoload
|
|
62
|
-
const postAutoload = await scopeTest.model.post.get({ id: postApple.id });
|
|
63
|
-
assert.equal(postAutoload!.user?.id, postAutoload!.userId);
|
|
64
|
-
assert.equal(cast(postAutoload?.user)?.iid, undefined);
|
|
65
|
-
assert.equal(Object.keys(postAutoload!.user!).length, 2); // id + name
|
|
66
|
-
// relation: hasMany
|
|
67
|
-
const users = await scopeTest.model.user.select({
|
|
68
|
-
where: {
|
|
69
|
-
id: [userTom.id, userJimmy.id],
|
|
70
|
-
},
|
|
71
|
-
orders: [['id', 'asc']],
|
|
72
|
-
include: { posts: true },
|
|
73
|
-
});
|
|
74
|
-
assert.equal(users.length, 2);
|
|
75
|
-
assert.equal(users[0].posts.length, 2);
|
|
76
|
-
assert.equal(users[1].posts.length, 0);
|
|
77
|
-
// relation: hasMany: options.where/orders
|
|
78
|
-
const userOptions = await scopeTest.model.user.select({
|
|
79
|
-
where: {
|
|
80
|
-
id: [userTom.id, userJimmy.id],
|
|
81
|
-
},
|
|
82
|
-
orders: [['id', 'asc']],
|
|
83
|
-
include: {
|
|
84
|
-
posts: {
|
|
85
|
-
where: {
|
|
86
|
-
id: { _in_: [postApple.id, postPear.id] },
|
|
87
|
-
},
|
|
88
|
-
orders: [['id', 'desc']],
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
assert.equal(userOptions.length, 2);
|
|
93
|
-
assert.equal(userOptions[0].posts.length, 2);
|
|
94
|
-
assert.equal(userOptions[1].posts.length, 0);
|
|
95
|
-
assert.equal(cast(userOptions[0].posts[0]).iid, undefined);
|
|
96
|
-
assert.equal(
|
|
97
|
-
Number.parseInt(userOptions[0].posts[0].id as any) >
|
|
98
|
-
Number.parseInt(userOptions[0].posts[1].id as any),
|
|
99
|
-
true,
|
|
100
|
-
);
|
|
101
|
-
// relation: hasMany: options.where/orders
|
|
102
|
-
const userOptions2 = await scopeTest.model.user.select({
|
|
103
|
-
where: {
|
|
104
|
-
id: [userTom.id, userJimmy.id],
|
|
105
|
-
},
|
|
106
|
-
orders: [['id', 'asc']],
|
|
107
|
-
include: {
|
|
108
|
-
posts: {
|
|
109
|
-
joins: [
|
|
110
|
-
[
|
|
111
|
-
'innerJoin',
|
|
112
|
-
'testVonaPostContent',
|
|
113
|
-
['testVonaPost.id', 'testVonaPostContent.postId'],
|
|
114
|
-
],
|
|
115
|
-
],
|
|
116
|
-
where: {
|
|
117
|
-
'testVonaPost.id': { _in_: [postApple.id, postPear.id] },
|
|
118
|
-
'_and_': { 'testVonaPost.id': { _notIn_: [postApple.id, postPear.id] } },
|
|
119
|
-
'testVonaPostContent.id': [postContentApple.id],
|
|
120
|
-
},
|
|
121
|
-
orders: [['testVonaPost.id', 'desc']],
|
|
122
|
-
},
|
|
123
|
-
roles: true,
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
assert.equal(userOptions2.length, 2);
|
|
127
|
-
assert.equal(userOptions2[0].posts.length, 0);
|
|
128
|
-
assert.equal(userOptions2[1].posts.length, 0);
|
|
129
|
-
// relation: hasMany: get
|
|
130
|
-
const userGet = await scopeTest.model.user.get(
|
|
131
|
-
{ id: userTom.id },
|
|
132
|
-
{ include: { posts: true } },
|
|
133
|
-
);
|
|
134
|
-
assert.equal(userGet?.posts.length, 2);
|
|
135
|
-
// relation: belongsToMany
|
|
136
|
-
const roles = await scopeTest.model.role.select({
|
|
137
|
-
where: {
|
|
138
|
-
id: [roleFamily.id, roleFriend.id],
|
|
139
|
-
},
|
|
140
|
-
orders: [['id', 'asc']],
|
|
141
|
-
include: { users: true },
|
|
142
|
-
});
|
|
143
|
-
assert.equal(roles.length, 2);
|
|
144
|
-
assert.equal(roles[0].users.length, 2);
|
|
145
|
-
assert.equal(roles[1].users.length, 1);
|
|
146
|
-
// relation: belongsToMany: get
|
|
147
|
-
const roleGet = await scopeTest.model.role.get(
|
|
148
|
-
{ id: roleFamily.id },
|
|
149
|
-
{ include: { users: true } },
|
|
150
|
-
);
|
|
151
|
-
assert.equal(roleGet?.users.length, 2);
|
|
152
|
-
assert.equal(cast(roleGet?.users[0]).iid, undefined);
|
|
153
|
-
// relation: belongsToMany: mget
|
|
154
|
-
const roles2 = await scopeTest.model.role.mget([roleFamily.id, roleFriend.id], {
|
|
155
|
-
columns: ['id', 'name'],
|
|
156
|
-
include: { users: true },
|
|
157
|
-
});
|
|
158
|
-
assert.equal(roles2.length, 2);
|
|
159
|
-
assert.equal(cast(roles2[0]).iid, undefined);
|
|
160
|
-
assert.equal(roles2[0].users.length, 2);
|
|
161
|
-
assert.equal(roles2[1].users.length, 1);
|
|
162
|
-
// relation: include + with
|
|
163
|
-
const items = await scopeTest.model.post.select({
|
|
164
|
-
where: {
|
|
165
|
-
id: postApple.id,
|
|
166
|
-
},
|
|
167
|
-
include: {
|
|
168
|
-
postContent: {
|
|
169
|
-
include: {
|
|
170
|
-
post: { include: { user: { columns: ['id'] } }, meta: { client: '_auto_' } },
|
|
171
|
-
},
|
|
172
|
-
with: {
|
|
173
|
-
post3: $relationDynamic.belongsTo(
|
|
174
|
-
() => ModelPostContent,
|
|
175
|
-
() => ModelPost,
|
|
176
|
-
'postId',
|
|
177
|
-
{
|
|
178
|
-
include: {
|
|
179
|
-
postContent: true,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
),
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
with: {
|
|
187
|
-
user3: $relationDynamic.belongsTo(ModelPost, () => ModelUser, 'userId', {
|
|
188
|
-
include: { posts: true },
|
|
189
|
-
with: {
|
|
190
|
-
roles: $relationDynamic.belongsToMany(
|
|
191
|
-
'test-vona:roleUser',
|
|
192
|
-
'test-vona:role',
|
|
193
|
-
'userId',
|
|
194
|
-
'roleId',
|
|
195
|
-
{
|
|
196
|
-
columns: ['id', 'name'],
|
|
197
|
-
meta: { client: '_auto_' },
|
|
198
|
-
},
|
|
199
|
-
),
|
|
200
|
-
},
|
|
201
|
-
columns: ['id', 'name'],
|
|
202
|
-
}),
|
|
203
|
-
},
|
|
204
|
-
});
|
|
205
|
-
assert.equal(Object.keys(items[0].postContent!.post!.user!).length, 1);
|
|
206
|
-
assert.equal(items[0].postContent?.post3?.postContent?.content !== undefined, true);
|
|
207
|
-
assert.equal(items[0].user3!.posts.length > 0, true);
|
|
208
|
-
assert.equal(items[0].user3!.roles.length > 0, true);
|
|
209
|
-
assert.equal(cast(items[0].user3!.roles[0]).iid, undefined);
|
|
210
|
-
assert.equal(cast(items[0].user3)?.iid, undefined);
|
|
211
|
-
// test data: delete
|
|
212
|
-
await scopeTest.service.testData.drop(testData);
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
});
|
package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelRelationsJoins.test.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
import { describe, it } from 'node:test';
|
|
3
|
-
import { app } from 'vona-mock';
|
|
4
|
-
|
|
5
|
-
describe('modelRelationsJoins.test.ts', () => {
|
|
6
|
-
it('action:modelRelationsJoins', async () => {
|
|
7
|
-
await app.bean.executor.mockCtx(async () => {
|
|
8
|
-
const prefix = 'action:modelRelationsJoins';
|
|
9
|
-
// scope
|
|
10
|
-
const scopeTest = app.scope('test-vona');
|
|
11
|
-
// test data: create
|
|
12
|
-
const testData = await scopeTest.service.testData.create(prefix);
|
|
13
|
-
const { userTom, userJimmy } = testData;
|
|
14
|
-
// joins: auto
|
|
15
|
-
const itemsJoins = await scopeTest.model.post.select({
|
|
16
|
-
joins: [['innerJoin', 'testVonaUser', ['testVonaPost.userId', 'testVonaUser.id']]],
|
|
17
|
-
where: {
|
|
18
|
-
'testVonaUser.id': userTom.id,
|
|
19
|
-
},
|
|
20
|
-
orders: [['testVonaUser.id', 'asc']],
|
|
21
|
-
});
|
|
22
|
-
assert.equal(itemsJoins.length, 2);
|
|
23
|
-
// joins: manual
|
|
24
|
-
const itemsJoins2 = await scopeTest.model.post.select(
|
|
25
|
-
{
|
|
26
|
-
joins: [['innerJoin', 'testVonaUser', ['testVonaPost.userId', 'testVonaUser.id']]],
|
|
27
|
-
where: {
|
|
28
|
-
'testVonaUser.id': userJimmy.id,
|
|
29
|
-
},
|
|
30
|
-
orders: [['testVonaUser.id', 'asc']],
|
|
31
|
-
},
|
|
32
|
-
{},
|
|
33
|
-
['test-vona:user'],
|
|
34
|
-
);
|
|
35
|
-
assert.equal(itemsJoins2.length, 0);
|
|
36
|
-
// joins: manual: no table prefix
|
|
37
|
-
const itemsJoins3 = await scopeTest.model.post.select(
|
|
38
|
-
{
|
|
39
|
-
columns: ['id', 'title'],
|
|
40
|
-
joins: [['innerJoin', 'testVonaUser', ['userId', 'testVonaUser.id']]],
|
|
41
|
-
where: {
|
|
42
|
-
'testVonaUser.id': userJimmy.id,
|
|
43
|
-
'userId': userJimmy.id,
|
|
44
|
-
},
|
|
45
|
-
orders: [
|
|
46
|
-
['testVonaUser.id', 'asc'],
|
|
47
|
-
['testVonaPost.createdAt', 'asc'],
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
{},
|
|
51
|
-
['test-vona:user'],
|
|
52
|
-
);
|
|
53
|
-
assert.equal(itemsJoins3.length, 0);
|
|
54
|
-
// test data: delete
|
|
55
|
-
await scopeTest.service.testData.drop(testData);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|