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
package/vona/src/suite-vendor/a-vona/modules/test-vona/test/database/modelRelationsMutate.test.ts
DELETED
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
import { describe, it } from 'node:test';
|
|
3
|
-
import { app } from 'vona-mock';
|
|
4
|
-
import { $relationMutate } from 'vona-module-a-orm';
|
|
5
|
-
import { ModelPost, ModelRole, ModelRoleUser } from 'vona-module-test-vona';
|
|
6
|
-
|
|
7
|
-
describe('modelRelationsMutate.test.ts', () => {
|
|
8
|
-
it('action:modelRelationsMutate', async () => {
|
|
9
|
-
await app.bean.executor.mockCtx(async () => {
|
|
10
|
-
const prefix = 'action:modelRelationsMutate';
|
|
11
|
-
// scope
|
|
12
|
-
const scopeTest = app.scope('test-vona');
|
|
13
|
-
// insert: roles
|
|
14
|
-
const roles = await scopeTest.model.role.insertBulk([
|
|
15
|
-
{ name: `${prefix}:family` },
|
|
16
|
-
{ name: `${prefix}:friend` },
|
|
17
|
-
]);
|
|
18
|
-
assert.equal(roles.length, 2);
|
|
19
|
-
assert.equal(roles[0].id !== undefined, true);
|
|
20
|
-
// insert: users
|
|
21
|
-
const users = await scopeTest.model.user.insertBulk(
|
|
22
|
-
[
|
|
23
|
-
{
|
|
24
|
-
name: `${prefix}:tom`,
|
|
25
|
-
posts: [
|
|
26
|
-
{
|
|
27
|
-
title: `${prefix}:postApple`,
|
|
28
|
-
postContent: {
|
|
29
|
-
content: `${prefix}:postContentApple`,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
roles: [
|
|
34
|
-
{
|
|
35
|
-
id: roles[0].id,
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
{
|
|
41
|
-
include: {
|
|
42
|
-
posts: { include: { postContent: true } },
|
|
43
|
-
roles: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
assert.equal(users.length, 1);
|
|
48
|
-
// check
|
|
49
|
-
const post = await scopeTest.model.post.get(
|
|
50
|
-
{ id: users[0].posts?.[0].id },
|
|
51
|
-
{ include: { postContent: true } },
|
|
52
|
-
);
|
|
53
|
-
assert.equal(post?.postContent?.content, `${prefix}:postContentApple`);
|
|
54
|
-
// update: users
|
|
55
|
-
const _usersUpdate = await scopeTest.model.user.update(
|
|
56
|
-
{
|
|
57
|
-
id: users[0].id,
|
|
58
|
-
posts: [
|
|
59
|
-
// update
|
|
60
|
-
{
|
|
61
|
-
id: users[0].posts?.[0].id,
|
|
62
|
-
title: `${prefix}:postApple-update`,
|
|
63
|
-
// update
|
|
64
|
-
postContent: {
|
|
65
|
-
content: `${prefix}:postContentApple-update`,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
// insert
|
|
69
|
-
{
|
|
70
|
-
title: `${prefix}:postPear`,
|
|
71
|
-
postContent: {
|
|
72
|
-
content: `${prefix}:postContentPear`,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
roles: [
|
|
77
|
-
// delete
|
|
78
|
-
{ id: users[0].roles![0].id, deleted: true },
|
|
79
|
-
// insert
|
|
80
|
-
{ id: roles[1].id },
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
include: {
|
|
85
|
-
posts: { include: { postContent: true } },
|
|
86
|
-
roles: true,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
);
|
|
90
|
-
// check
|
|
91
|
-
const usersUpdateCheck = await scopeTest.model.user.get(
|
|
92
|
-
{
|
|
93
|
-
id: users[0].id,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
include: {
|
|
97
|
-
posts: {
|
|
98
|
-
include: { postContent: true },
|
|
99
|
-
orders: [['id', 'asc']],
|
|
100
|
-
},
|
|
101
|
-
roles: true,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
);
|
|
105
|
-
assert.equal(usersUpdateCheck?.posts.length, 2);
|
|
106
|
-
assert.equal(usersUpdateCheck?.posts[0].title, `${prefix}:postApple-update`);
|
|
107
|
-
assert.equal(
|
|
108
|
-
usersUpdateCheck?.posts[0].postContent?.content,
|
|
109
|
-
`${prefix}:postContentApple-update`,
|
|
110
|
-
);
|
|
111
|
-
assert.equal(usersUpdateCheck?.posts[1].postContent?.content, `${prefix}:postContentPear`);
|
|
112
|
-
assert.equal(usersUpdateCheck?.roles.length, 1);
|
|
113
|
-
assert.equal(usersUpdateCheck?.roles[0].id, roles[1].id);
|
|
114
|
-
// mutate: users
|
|
115
|
-
const _usersMutate = await scopeTest.model.user.mutate(
|
|
116
|
-
{
|
|
117
|
-
id: users[0].id,
|
|
118
|
-
posts: [
|
|
119
|
-
// update
|
|
120
|
-
{
|
|
121
|
-
id: users[0].posts![0].id,
|
|
122
|
-
title: `${prefix}:postApple-mutate`,
|
|
123
|
-
// update
|
|
124
|
-
postContent: {
|
|
125
|
-
id: users[0].posts![0].postContent?.id,
|
|
126
|
-
content: `${prefix}:postContentApple-mutate`,
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
roles: [
|
|
131
|
-
// delete
|
|
132
|
-
{ id: roles[1].id, deleted: true },
|
|
133
|
-
],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
include: {
|
|
137
|
-
posts: { include: { postContent: true } },
|
|
138
|
-
roles: true,
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
);
|
|
142
|
-
// check
|
|
143
|
-
const usersMutateCheck = await scopeTest.model.user.get(
|
|
144
|
-
{
|
|
145
|
-
id: users[0].id,
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
include: {
|
|
149
|
-
posts: {
|
|
150
|
-
include: { postContent: true },
|
|
151
|
-
orders: [['id', 'asc']],
|
|
152
|
-
},
|
|
153
|
-
roles: { columns: '*' as any },
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
);
|
|
157
|
-
assert.equal(usersMutateCheck?.posts.length, 2);
|
|
158
|
-
assert.equal(usersMutateCheck?.posts[0].title, `${prefix}:postApple-mutate`);
|
|
159
|
-
assert.equal(
|
|
160
|
-
usersMutateCheck?.posts[0].postContent?.content,
|
|
161
|
-
`${prefix}:postContentApple-mutate`,
|
|
162
|
-
);
|
|
163
|
-
assert.equal(usersMutateCheck?.posts[1].postContent?.content, `${prefix}:postContentPear`);
|
|
164
|
-
assert.equal(usersMutateCheck?.roles.length, 0);
|
|
165
|
-
// delete: users
|
|
166
|
-
await scopeTest.model.user.deleteBulk(
|
|
167
|
-
users.map(item => item.id),
|
|
168
|
-
{
|
|
169
|
-
include: {
|
|
170
|
-
posts: { include: { postContent: true } },
|
|
171
|
-
roles: true,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
);
|
|
175
|
-
const roleUsers = await scopeTest.model.roleUser.select({
|
|
176
|
-
where: { userId: users.map(item => item.id) },
|
|
177
|
-
});
|
|
178
|
-
assert.equal(roleUsers.length, 0);
|
|
179
|
-
// delete: roles
|
|
180
|
-
await scopeTest.model.role.deleteBulk(roles.map(item => item.id));
|
|
181
|
-
const roles2 = await scopeTest.model.role.select(
|
|
182
|
-
{
|
|
183
|
-
where: {
|
|
184
|
-
id: roles.map(item => item.id!),
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
{ disableDeleted: true },
|
|
188
|
-
);
|
|
189
|
-
assert.equal(roles2.length, 2);
|
|
190
|
-
assert.equal(roles2[0].id !== undefined, true);
|
|
191
|
-
assert.equal(roles2[0].deleted, true);
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('action:modelRelationsMutateWith', async () => {
|
|
196
|
-
await app.bean.executor.mockCtx(async () => {
|
|
197
|
-
const prefix = 'action:modelRelationsMutateWith';
|
|
198
|
-
// scope
|
|
199
|
-
const scopeTest = app.scope('test-vona');
|
|
200
|
-
// insert: roles
|
|
201
|
-
const roles = await scopeTest.model.role.insertBulk([
|
|
202
|
-
{ name: `${prefix}:family` },
|
|
203
|
-
{ name: `${prefix}:friend` },
|
|
204
|
-
]);
|
|
205
|
-
assert.equal(roles.length, 2);
|
|
206
|
-
assert.equal(roles[0].id !== undefined, true);
|
|
207
|
-
// insert: users
|
|
208
|
-
const users = await scopeTest.model.user.insertBulk(
|
|
209
|
-
[
|
|
210
|
-
{
|
|
211
|
-
name: `${prefix}:tom`,
|
|
212
|
-
posts: [
|
|
213
|
-
{
|
|
214
|
-
title: `${prefix}:postApple`,
|
|
215
|
-
postContent: {
|
|
216
|
-
content: `${prefix}:postContentApple`,
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
],
|
|
220
|
-
roles: [
|
|
221
|
-
{
|
|
222
|
-
id: roles[0].id,
|
|
223
|
-
},
|
|
224
|
-
],
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
{
|
|
228
|
-
with: {
|
|
229
|
-
posts: $relationMutate.hasMany(ModelPost, 'userId', { include: { postContent: true } }),
|
|
230
|
-
roles: $relationMutate.belongsToMany(ModelRoleUser, ModelRole, 'userId', 'roleId'),
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
);
|
|
234
|
-
assert.equal(users.length, 1);
|
|
235
|
-
// check
|
|
236
|
-
const post = await scopeTest.model.post.get(
|
|
237
|
-
{ id: users[0].posts![0].id },
|
|
238
|
-
{ include: { postContent: true } },
|
|
239
|
-
);
|
|
240
|
-
assert.equal(post?.postContent?.content, `${prefix}:postContentApple`);
|
|
241
|
-
// update: users
|
|
242
|
-
const _usersUpdate = await scopeTest.model.user.update(
|
|
243
|
-
{
|
|
244
|
-
id: users[0].id,
|
|
245
|
-
posts: [
|
|
246
|
-
// update
|
|
247
|
-
{
|
|
248
|
-
id: users[0].posts![0].id,
|
|
249
|
-
title: `${prefix}:postApple-update`,
|
|
250
|
-
// update
|
|
251
|
-
postContent: {
|
|
252
|
-
content: `${prefix}:postContentApple-update`,
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
// insert
|
|
256
|
-
{
|
|
257
|
-
title: `${prefix}:postPear`,
|
|
258
|
-
postContent: {
|
|
259
|
-
content: `${prefix}:postContentPear`,
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
roles: [
|
|
264
|
-
// delete
|
|
265
|
-
{ id: users[0].roles![0].id, deleted: true },
|
|
266
|
-
// insert
|
|
267
|
-
{ id: roles[1].id },
|
|
268
|
-
],
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
with: {
|
|
272
|
-
posts: $relationMutate.hasMany(ModelPost, 'userId', { include: { postContent: true } }),
|
|
273
|
-
roles: $relationMutate.belongsToMany(ModelRoleUser, ModelRole, 'userId', 'roleId'),
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
);
|
|
277
|
-
// check
|
|
278
|
-
const usersUpdateCheck = await scopeTest.model.user.get(
|
|
279
|
-
{
|
|
280
|
-
id: users[0].id,
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
include: {
|
|
284
|
-
posts: {
|
|
285
|
-
include: { postContent: true },
|
|
286
|
-
orders: [['id', 'asc']],
|
|
287
|
-
},
|
|
288
|
-
roles: true,
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
);
|
|
292
|
-
assert.equal(usersUpdateCheck?.posts.length, 2);
|
|
293
|
-
assert.equal(usersUpdateCheck?.posts[0].title, `${prefix}:postApple-update`);
|
|
294
|
-
assert.equal(
|
|
295
|
-
usersUpdateCheck?.posts[0].postContent?.content,
|
|
296
|
-
`${prefix}:postContentApple-update`,
|
|
297
|
-
);
|
|
298
|
-
assert.equal(usersUpdateCheck?.posts[1].postContent?.content, `${prefix}:postContentPear`);
|
|
299
|
-
assert.equal(usersUpdateCheck?.roles.length, 1);
|
|
300
|
-
assert.equal(usersUpdateCheck?.roles[0].id, roles[1].id);
|
|
301
|
-
// mutate: users
|
|
302
|
-
const _usersMutate = await scopeTest.model.user.mutate(
|
|
303
|
-
{
|
|
304
|
-
id: users[0].id,
|
|
305
|
-
posts: [
|
|
306
|
-
// update
|
|
307
|
-
{
|
|
308
|
-
id: users[0].posts![0].id,
|
|
309
|
-
title: `${prefix}:postApple-mutate`,
|
|
310
|
-
// update
|
|
311
|
-
postContent: {
|
|
312
|
-
id: users[0].posts![0].postContent?.id,
|
|
313
|
-
content: `${prefix}:postContentApple-mutate`,
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
],
|
|
317
|
-
roles: [
|
|
318
|
-
// delete
|
|
319
|
-
{ id: roles[1].id, deleted: true },
|
|
320
|
-
],
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
with: {
|
|
324
|
-
posts: $relationMutate.hasMany(ModelPost, 'userId', { include: { postContent: true } }),
|
|
325
|
-
roles: $relationMutate.belongsToMany(ModelRoleUser, ModelRole, 'userId', 'roleId'),
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
);
|
|
329
|
-
// check
|
|
330
|
-
const usersMutateCheck = await scopeTest.model.user.get(
|
|
331
|
-
{
|
|
332
|
-
id: users[0].id,
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
include: {
|
|
336
|
-
posts: {
|
|
337
|
-
include: { postContent: true },
|
|
338
|
-
orders: [['id', 'asc']],
|
|
339
|
-
},
|
|
340
|
-
roles: { columns: '*' as any },
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
);
|
|
344
|
-
assert.equal(usersMutateCheck?.posts.length, 2);
|
|
345
|
-
assert.equal(usersMutateCheck?.posts[0].title, `${prefix}:postApple-mutate`);
|
|
346
|
-
assert.equal(
|
|
347
|
-
usersMutateCheck?.posts[0].postContent?.content,
|
|
348
|
-
`${prefix}:postContentApple-mutate`,
|
|
349
|
-
);
|
|
350
|
-
assert.equal(usersMutateCheck?.posts[1].postContent?.content, `${prefix}:postContentPear`);
|
|
351
|
-
assert.equal(usersMutateCheck?.roles.length, 0);
|
|
352
|
-
// delete: users
|
|
353
|
-
await scopeTest.model.user.deleteBulk(
|
|
354
|
-
users.map(item => item.id),
|
|
355
|
-
{
|
|
356
|
-
with: {
|
|
357
|
-
posts: $relationMutate.hasMany(ModelPost, 'userId', { include: { postContent: true } }),
|
|
358
|
-
roles: $relationMutate.belongsToMany(ModelRoleUser, ModelRole, 'userId', 'roleId'),
|
|
359
|
-
},
|
|
360
|
-
},
|
|
361
|
-
);
|
|
362
|
-
const roleUsers = await scopeTest.model.roleUser.select({
|
|
363
|
-
where: { userId: users.map(item => item.id) },
|
|
364
|
-
});
|
|
365
|
-
assert.equal(roleUsers.length, 0);
|
|
366
|
-
// delete: roles
|
|
367
|
-
await scopeTest.model.role.deleteBulk(roles.map(item => item.id));
|
|
368
|
-
const roles2 = await scopeTest.model.role.select(
|
|
369
|
-
{
|
|
370
|
-
where: {
|
|
371
|
-
id: roles.map(item => item.id!),
|
|
372
|
-
},
|
|
373
|
-
},
|
|
374
|
-
{ disableDeleted: true },
|
|
375
|
-
);
|
|
376
|
-
assert.equal(roles2.length, 2);
|
|
377
|
-
assert.equal(roles2[0].id !== undefined, true);
|
|
378
|
-
assert.equal(roles2[0].deleted, true);
|
|
379
|
-
});
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
it('action:modelRelationsMutateTree', async () => {
|
|
383
|
-
await app.bean.executor.mockCtx(async () => {
|
|
384
|
-
const prefix = 'action:modelRelationsMutateTree';
|
|
385
|
-
// scope
|
|
386
|
-
const scopeTest = app.scope('test-vona');
|
|
387
|
-
// create: categoryTree
|
|
388
|
-
const categoryTree = await scopeTest.model.category.insert({
|
|
389
|
-
name: `${prefix}:1`,
|
|
390
|
-
children: [
|
|
391
|
-
{
|
|
392
|
-
name: `${prefix}:1-1`,
|
|
393
|
-
children: [{ name: `${prefix}:1-1-1` }, { name: `${prefix}:1-1-2` }],
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
name: `${prefix}:1-2`,
|
|
397
|
-
},
|
|
398
|
-
],
|
|
399
|
-
});
|
|
400
|
-
const categoryTreeCheck = await scopeTest.model.category.get({ id: categoryTree.id });
|
|
401
|
-
assert.equal(categoryTree.id, categoryTreeCheck?.id);
|
|
402
|
-
const children = categoryTree.children!.sort((a, b) => Number(a.id) - Number(b.id));
|
|
403
|
-
const childrenCheck = categoryTreeCheck!.children.sort((a, b) => Number(a.id) - Number(b.id));
|
|
404
|
-
assert.equal(children[0].name, childrenCheck[0].name);
|
|
405
|
-
assert.equal(children[0].name, `${prefix}:1-1`);
|
|
406
|
-
assert.equal(children[0].children?.length, childrenCheck[0].children.length);
|
|
407
|
-
assert.equal(children[0].children?.length, 2);
|
|
408
|
-
// get: categoryChain
|
|
409
|
-
const categoryChain = await scopeTest.model.categoryChain.get({
|
|
410
|
-
id: children[0].children![0].id,
|
|
411
|
-
});
|
|
412
|
-
assert.equal(categoryChain?.parent?.id, children[0].id);
|
|
413
|
-
assert.equal(categoryChain?.parent?.parent?.id, categoryTree.id);
|
|
414
|
-
assert.equal(categoryChain?.parent?.parent?.parent, undefined);
|
|
415
|
-
// delete: categoryTree
|
|
416
|
-
const items = await scopeTest.model.category.select({
|
|
417
|
-
where: {
|
|
418
|
-
name: { _startsWith_: `${prefix}:` },
|
|
419
|
-
},
|
|
420
|
-
include: { children: false },
|
|
421
|
-
});
|
|
422
|
-
assert.equal(items.length, 5);
|
|
423
|
-
await scopeTest.model.category.delete(
|
|
424
|
-
{ id: categoryTree.id },
|
|
425
|
-
{ include: { children: { meta: { client: '_auto_' } } } },
|
|
426
|
-
);
|
|
427
|
-
const items2 = await scopeTest.model.category.select({
|
|
428
|
-
where: {
|
|
429
|
-
name: { _startsWith_: `${prefix}:` },
|
|
430
|
-
},
|
|
431
|
-
include: { children: false },
|
|
432
|
-
});
|
|
433
|
-
assert.equal(items2.length, 0);
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
});
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import type { Knex } from 'knex';
|
|
2
|
-
|
|
3
|
-
import assert from 'node:assert';
|
|
4
|
-
import { describe, it } from 'node:test';
|
|
5
|
-
import { app } from 'vona-mock';
|
|
6
|
-
|
|
7
|
-
describe('modelWhere.test.ts', () => {
|
|
8
|
-
it('action:modelWhere', async () => {
|
|
9
|
-
await app.bean.executor.mockCtx(async () => {
|
|
10
|
-
if (app.bean.database.current.dialectName !== 'pg') return;
|
|
11
|
-
const scopeTest = app.scope('test-vona');
|
|
12
|
-
// ref
|
|
13
|
-
let builder = scopeTest.model.post.builder();
|
|
14
|
-
scopeTest.model.post.buildWhere(builder, { id: scopeTest.model.post.ref('id') as any });
|
|
15
|
-
let sql = builder.toQuery();
|
|
16
|
-
assert.equal(sql, 'select * from "testVonaPost" where "id" = "id"');
|
|
17
|
-
builder = scopeTest.model.post.builder();
|
|
18
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
19
|
-
id: scopeTest.model.post.ref('testVonaPost.id') as any,
|
|
20
|
-
});
|
|
21
|
-
sql = builder.toQuery();
|
|
22
|
-
assert.equal(sql, 'select * from "testVonaPost" where "id" = "testVonaPost"."id"');
|
|
23
|
-
// raw
|
|
24
|
-
builder = scopeTest.model.post.builder();
|
|
25
|
-
scopeTest.model.post.buildWhere(
|
|
26
|
-
builder,
|
|
27
|
-
scopeTest.model.post.raw('?? = ?', ['id', 1]) as any,
|
|
28
|
-
);
|
|
29
|
-
sql = builder.toQuery();
|
|
30
|
-
assert.equal(sql, 'select * from "testVonaPost" where "id" = 1');
|
|
31
|
-
// op: normal
|
|
32
|
-
builder = scopeTest.model.post.builder();
|
|
33
|
-
scopeTest.model.post.buildWhere(builder, { id: 1 });
|
|
34
|
-
sql = builder.toQuery();
|
|
35
|
-
assert.equal(sql, 'select * from "testVonaPost" where "id" = 1');
|
|
36
|
-
// op: normal: joint
|
|
37
|
-
builder = scopeTest.model.post.builder();
|
|
38
|
-
scopeTest.model.post.buildWhere(builder, { id: { _or_: { _eq_: 3, _gt_: 4 } } });
|
|
39
|
-
sql = builder.toQuery();
|
|
40
|
-
assert.equal(sql, 'select * from "testVonaPost" where ((("id" = 3) or ("id" > 4)))');
|
|
41
|
-
// op: and
|
|
42
|
-
builder = scopeTest.model.post.builder();
|
|
43
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
44
|
-
_and_: { iid: 1, id: 2 },
|
|
45
|
-
});
|
|
46
|
-
sql = builder.toQuery();
|
|
47
|
-
assert.equal(sql, 'select * from "testVonaPost" where (("iid" = 1) and ("id" = 2))');
|
|
48
|
-
// op: and: empty
|
|
49
|
-
builder = scopeTest.model.post.builder();
|
|
50
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
51
|
-
_and_: { _and_: {} },
|
|
52
|
-
});
|
|
53
|
-
sql = builder.toQuery();
|
|
54
|
-
assert.equal(sql, 'select * from "testVonaPost"');
|
|
55
|
-
// op: or
|
|
56
|
-
builder = scopeTest.model.post.builder();
|
|
57
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
58
|
-
_or_: { iid: 1, id: 2 },
|
|
59
|
-
});
|
|
60
|
-
sql = builder.toQuery();
|
|
61
|
-
assert.equal(sql, 'select * from "testVonaPost" where (("iid" = 1) or ("id" = 2))');
|
|
62
|
-
// op: or: more
|
|
63
|
-
builder = scopeTest.model.post.builder();
|
|
64
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
65
|
-
_or_: {
|
|
66
|
-
_and_: { iid: 1, id: 2 },
|
|
67
|
-
title: 'test',
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
sql = builder.toQuery();
|
|
71
|
-
assert.equal(
|
|
72
|
-
sql,
|
|
73
|
-
'select * from "testVonaPost" where (((("iid" = 1) and ("id" = 2))) or ("title" = \'test\'))',
|
|
74
|
-
);
|
|
75
|
-
// op: not
|
|
76
|
-
builder = scopeTest.model.post.builder();
|
|
77
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
78
|
-
_not_: { iid: 1, id: 2 },
|
|
79
|
-
});
|
|
80
|
-
sql = builder.toQuery();
|
|
81
|
-
assert.equal(sql, 'select * from "testVonaPost" where not ("iid" = 1 and "id" = 2)');
|
|
82
|
-
// op: exists
|
|
83
|
-
builder = scopeTest.model.post.builder();
|
|
84
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
85
|
-
_exists_: function (this: Knex.QueryBuilder) {
|
|
86
|
-
this.select('id')
|
|
87
|
-
.from('testVonaUser')
|
|
88
|
-
.where({ 'testVonaUser.id': app.bean.model.ref('userId') });
|
|
89
|
-
} as any,
|
|
90
|
-
});
|
|
91
|
-
sql = builder.toQuery();
|
|
92
|
-
assert.equal(
|
|
93
|
-
sql,
|
|
94
|
-
'select * from "testVonaPost" where exists (select "id" from "testVonaUser" where "testVonaUser"."id" = "userId")',
|
|
95
|
-
);
|
|
96
|
-
// op: notExists
|
|
97
|
-
builder = scopeTest.model.post.builder();
|
|
98
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
99
|
-
_notExists_: function (this: Knex.QueryBuilder) {
|
|
100
|
-
this.select('id')
|
|
101
|
-
.from('testVonaUser')
|
|
102
|
-
.where({ 'testVonaUser.id': app.bean.model.ref('userId') });
|
|
103
|
-
} as any,
|
|
104
|
-
});
|
|
105
|
-
sql = builder.toQuery();
|
|
106
|
-
assert.equal(
|
|
107
|
-
sql,
|
|
108
|
-
'select * from "testVonaPost" where not exists (select "id" from "testVonaUser" where "testVonaUser"."id" = "userId")',
|
|
109
|
-
);
|
|
110
|
-
// op: array direct/in/notIn
|
|
111
|
-
builder = scopeTest.model.post.builder();
|
|
112
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
113
|
-
id: [1, 2],
|
|
114
|
-
iid: [],
|
|
115
|
-
_or_: { id: { _in_: [2, 3] }, iid: { _notIn_: [3, 4] } },
|
|
116
|
-
});
|
|
117
|
-
sql = builder.toQuery();
|
|
118
|
-
assert.equal(
|
|
119
|
-
sql,
|
|
120
|
-
'select * from "testVonaPost" where "id" in (1, 2) and 1 = 0 and ((("id" in (2, 3))) or (("iid" not in (3, 4))))',
|
|
121
|
-
);
|
|
122
|
-
// op: null/notNull
|
|
123
|
-
builder = scopeTest.model.post.builder();
|
|
124
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
125
|
-
id: { _is_: null },
|
|
126
|
-
iid: { _isNot_: undefined },
|
|
127
|
-
});
|
|
128
|
-
sql = builder.toQuery();
|
|
129
|
-
assert.equal(
|
|
130
|
-
sql,
|
|
131
|
-
'select * from "testVonaPost" where ("id" is null) and ("iid" is not null)',
|
|
132
|
-
);
|
|
133
|
-
// op: between/notBetween
|
|
134
|
-
builder = scopeTest.model.post.builder();
|
|
135
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
136
|
-
id: { _between_: [1, 3] },
|
|
137
|
-
iid: { _notBetween_: [2, 4] },
|
|
138
|
-
});
|
|
139
|
-
sql = builder.toQuery();
|
|
140
|
-
assert.equal(
|
|
141
|
-
sql,
|
|
142
|
-
'select * from "testVonaPost" where ("id" between 1 and 3) and ("iid" not between 2 and 4)',
|
|
143
|
-
);
|
|
144
|
-
// op: ref
|
|
145
|
-
builder = scopeTest.model.post.builder();
|
|
146
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
147
|
-
iid: { _ref_: 'id' },
|
|
148
|
-
});
|
|
149
|
-
sql = builder.toQuery();
|
|
150
|
-
assert.equal(sql, 'select * from "testVonaPost" where ("iid" = "id")');
|
|
151
|
-
// op: gt/gte/lt/lte
|
|
152
|
-
builder = scopeTest.model.post.builder();
|
|
153
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
154
|
-
id: { _gt_: 1, _gte_: 2, _lt_: 3, _lte_: 4 },
|
|
155
|
-
});
|
|
156
|
-
sql = builder.toQuery();
|
|
157
|
-
assert.equal(
|
|
158
|
-
sql,
|
|
159
|
-
'select * from "testVonaPost" where ("id" > 1 and "id" >= 2 and "id" < 3 and "id" <= 4)',
|
|
160
|
-
);
|
|
161
|
-
// op: startsWith/endsWith/includes
|
|
162
|
-
builder = scopeTest.model.post.builder();
|
|
163
|
-
scopeTest.model.post.buildWhere(builder, {
|
|
164
|
-
title: { _startsWith_: 'a', _endsWith_: 'b', _includes_: 'c' },
|
|
165
|
-
});
|
|
166
|
-
sql = builder.toQuery();
|
|
167
|
-
assert.equal(
|
|
168
|
-
sql,
|
|
169
|
-
'select * from "testVonaPost" where ("title" like \'a%\' and "title" like \'%b\' and "title" like \'%c%\')',
|
|
170
|
-
);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { describe, it } from 'node:test';
|
|
2
|
-
import { app } from 'vona-mock';
|
|
3
|
-
|
|
4
|
-
describe('orm.test.ts', () => {
|
|
5
|
-
it('action:orm:hasOne', async () => {
|
|
6
|
-
await app.bean.executor.mockCtx(async () => {
|
|
7
|
-
// scope
|
|
8
|
-
const scopeTest = app.scope('test-vona');
|
|
9
|
-
// create: post/postContent
|
|
10
|
-
const post1 = await scopeTest.model.post.insert({
|
|
11
|
-
title: 'action:orm:hasOne:post1',
|
|
12
|
-
});
|
|
13
|
-
const postContent1 = await scopeTest.model.postContent.insert({
|
|
14
|
-
content: 'action:orm:hasOne:content',
|
|
15
|
-
postId: post1.id,
|
|
16
|
-
});
|
|
17
|
-
// delete
|
|
18
|
-
await scopeTest.model.post.delete({ id: post1.id });
|
|
19
|
-
await scopeTest.model.postContent.delete({ id: postContent1.id });
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
});
|