cabloy 5.1.49 → 5.1.51
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/.claude/skills/cabloy-backend-scaffold/SKILL.md +207 -0
- package/.claude/skills/cabloy-backend-scaffold/evals/evals.json +29 -0
- package/.claude/skills/cabloy-backend-scaffold/references/backend-thread-map.md +52 -0
- package/.claude/skills/cabloy-backend-scaffold/references/follow-up-checklist.md +39 -0
- package/.claude/skills/cabloy-contract-loop/SKILL.md +201 -0
- package/.claude/skills/cabloy-contract-loop/evals/evals.json +29 -0
- package/.claude/skills/cabloy-contract-loop/references/contract-loop-map.md +47 -0
- package/.claude/skills/cabloy-contract-loop/references/verification-checklist.md +32 -0
- package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +230 -0
- package/.claude/skills/cabloy-frontend-scaffold/evals/evals.json +35 -0
- package/.claude/skills/cabloy-frontend-scaffold/references/follow-up-checklist.md +41 -0
- package/.claude/skills/cabloy-frontend-scaffold/references/frontend-thread-map.md +54 -0
- package/.claude/skills/cabloy-workflow/SKILL.md +288 -0
- package/.claude/skills/cabloy-workflow/evals/evals.json +35 -0
- package/.claude/skills/cabloy-workflow/references/cli-strategy.md +39 -0
- package/.claude/skills/cabloy-workflow/references/edition-detection.md +29 -0
- package/.github/workflows/docs-pages.yml +54 -0
- package/.gitignore +1 -0
- package/CHANGELOG.md +46 -0
- package/CLAUDE.md +59 -0
- package/README.md +137 -0
- package/cabloy-docs/.vitepress/config.mjs +222 -0
- package/cabloy-docs/.vitepress/public/CNAME +1 -0
- package/cabloy-docs/.vitepress/theme/custom.css +64 -0
- package/cabloy-docs/.vitepress/theme/edition-badges.md +5 -0
- package/cabloy-docs/.vitepress/theme/index.js +5 -0
- package/cabloy-docs/ai/class-placement-rule.md +138 -0
- package/cabloy-docs/ai/cli-for-agents.md +56 -0
- package/cabloy-docs/ai/cli-to-skill-map.md +165 -0
- package/cabloy-docs/ai/docs-skills-rules-mapping.md +167 -0
- package/cabloy-docs/ai/edition-detection.md +30 -0
- package/cabloy-docs/ai/future-skill-roadmap.md +135 -0
- package/cabloy-docs/ai/global-bean-lookup.md +157 -0
- package/cabloy-docs/ai/introduction.md +62 -0
- package/cabloy-docs/ai/playbook-backend-module.md +111 -0
- package/cabloy-docs/ai/playbook-contract-regeneration.md +100 -0
- package/cabloy-docs/ai/playbook-frontend-page.md +99 -0
- package/cabloy-docs/ai/playbook-metadata-refresh.md +67 -0
- package/cabloy-docs/ai/repo-guidance.md +58 -0
- package/cabloy-docs/ai/rules-and-config.md +29 -0
- package/cabloy-docs/ai/skills.md +35 -0
- package/cabloy-docs/ai/verification.md +30 -0
- package/cabloy-docs/backend/aop-overview.md +128 -0
- package/cabloy-docs/backend/auth-guide.md +151 -0
- package/cabloy-docs/backend/backend-essentials.md +128 -0
- package/cabloy-docs/backend/broadcast-guide.md +138 -0
- package/cabloy-docs/backend/cache-guide.md +70 -0
- package/cabloy-docs/backend/captcha-guide.md +162 -0
- package/cabloy-docs/backend/cli.md +173 -0
- package/cabloy-docs/backend/config-guide.md +249 -0
- package/cabloy-docs/backend/controller-aop-guide.md +270 -0
- package/cabloy-docs/backend/controller-guide.md +347 -0
- package/cabloy-docs/backend/crud-workflow.md +118 -0
- package/cabloy-docs/backend/dto-guide.md +161 -0
- package/cabloy-docs/backend/dto-infer-generation.md +153 -0
- package/cabloy-docs/backend/dynamic-datasource-guide.md +70 -0
- package/cabloy-docs/backend/election-guide.md +141 -0
- package/cabloy-docs/backend/entity-guide.md +150 -0
- package/cabloy-docs/backend/error-guide.md +108 -0
- package/cabloy-docs/backend/event-guide.md +183 -0
- package/cabloy-docs/backend/external-aop-guide.md +149 -0
- package/cabloy-docs/backend/field-indexes.md +79 -0
- package/cabloy-docs/backend/foundation.md +281 -0
- package/cabloy-docs/backend/i18n-guide.md +211 -0
- package/cabloy-docs/backend/internal-aop-guide.md +181 -0
- package/cabloy-docs/backend/introduction.md +95 -0
- package/cabloy-docs/backend/jwt-guide.md +276 -0
- package/cabloy-docs/backend/logger-guide.md +223 -0
- package/cabloy-docs/backend/mail-guide.md +189 -0
- package/cabloy-docs/backend/menu-guide.md +80 -0
- package/cabloy-docs/backend/migration-and-changes.md +192 -0
- package/cabloy-docs/backend/model-guide.md +274 -0
- package/cabloy-docs/backend/multi-database-datasource.md +171 -0
- package/cabloy-docs/backend/multi-instance-and-instance-resolution.md +196 -0
- package/cabloy-docs/backend/openapi-guide.md +118 -0
- package/cabloy-docs/backend/orm-aggregate-group-guide.md +210 -0
- package/cabloy-docs/backend/orm-configuration-guide.md +165 -0
- package/cabloy-docs/backend/orm-guide.md +109 -0
- package/cabloy-docs/backend/orm-mutation-guide.md +195 -0
- package/cabloy-docs/backend/orm-select-guide.md +243 -0
- package/cabloy-docs/backend/queue-guide.md +271 -0
- package/cabloy-docs/backend/quickstart.md +141 -0
- package/cabloy-docs/backend/redis-guide.md +70 -0
- package/cabloy-docs/backend/redlock-guide.md +60 -0
- package/cabloy-docs/backend/relations-guide.md +250 -0
- package/cabloy-docs/backend/runtime-and-flavors.md +304 -0
- package/cabloy-docs/backend/schedule-guide.md +81 -0
- package/cabloy-docs/backend/scripts.md +116 -0
- package/cabloy-docs/backend/serialization-guide.md +192 -0
- package/cabloy-docs/backend/service-guide.md +166 -0
- package/cabloy-docs/backend/sharding-guide.md +49 -0
- package/cabloy-docs/backend/startup-guide.md +326 -0
- package/cabloy-docs/backend/transaction-guide.md +82 -0
- package/cabloy-docs/backend/unit-testing.md +209 -0
- package/cabloy-docs/backend/upload-guide.md +160 -0
- package/cabloy-docs/backend/user-access-guide.md +157 -0
- package/cabloy-docs/backend/validation-guide.md +80 -0
- package/cabloy-docs/backend/worker-guide.md +59 -0
- package/cabloy-docs/editions/cabloy-basic.md +25 -0
- package/cabloy-docs/editions/cabloy-start.md +24 -0
- package/cabloy-docs/editions/detection.md +31 -0
- package/cabloy-docs/editions/overview.md +44 -0
- package/cabloy-docs/frontend/api-guide.md +93 -0
- package/cabloy-docs/frontend/api-schema-guide.md +43 -0
- package/cabloy-docs/frontend/app-startup-guide.md +185 -0
- package/cabloy-docs/frontend/cli.md +78 -0
- package/cabloy-docs/frontend/component-guide.md +105 -0
- package/cabloy-docs/frontend/component-props-guide.md +97 -0
- package/cabloy-docs/frontend/component-v-model-guide.md +110 -0
- package/cabloy-docs/frontend/css-in-js-guide.md +151 -0
- package/cabloy-docs/frontend/design-principles.md +55 -0
- package/cabloy-docs/frontend/environment-config-guide.md +250 -0
- package/cabloy-docs/frontend/foundation.md +57 -0
- package/cabloy-docs/frontend/generic-component-guide.md +35 -0
- package/cabloy-docs/frontend/icon-engine-guide.md +88 -0
- package/cabloy-docs/frontend/introduction.md +32 -0
- package/cabloy-docs/frontend/ioc-and-beans.md +211 -0
- package/cabloy-docs/frontend/mock-guide.md +109 -0
- package/cabloy-docs/frontend/model-architecture.md +87 -0
- package/cabloy-docs/frontend/model-state-guide.md +70 -0
- package/cabloy-docs/frontend/module-scope.md +168 -0
- package/cabloy-docs/frontend/modules-and-suites.md +179 -0
- package/cabloy-docs/frontend/navigation-guards-guide.md +68 -0
- package/cabloy-docs/frontend/openapi-sdk-guide.md +102 -0
- package/cabloy-docs/frontend/page-guide.md +223 -0
- package/cabloy-docs/frontend/page-params-guide.md +87 -0
- package/cabloy-docs/frontend/page-query-guide.md +96 -0
- package/cabloy-docs/frontend/page-route-guide.md +147 -0
- package/cabloy-docs/frontend/quickstart.md +201 -0
- package/cabloy-docs/frontend/route-alias-guide.md +61 -0
- package/cabloy-docs/frontend/scripts.md +86 -0
- package/cabloy-docs/frontend/sdk-guide.md +45 -0
- package/cabloy-docs/frontend/server-data.md +74 -0
- package/cabloy-docs/frontend/ssr-client-only.md +40 -0
- package/cabloy-docs/frontend/ssr-env.md +51 -0
- package/cabloy-docs/frontend/ssr-init-data.md +46 -0
- package/cabloy-docs/frontend/ssr-overview.md +48 -0
- package/cabloy-docs/frontend/ssr-seo-meta.md +52 -0
- package/cabloy-docs/frontend/system-startup-guide.md +186 -0
- package/cabloy-docs/frontend/theme-guide.md +154 -0
- package/cabloy-docs/frontend/zod-guide.md +161 -0
- package/cabloy-docs/fullstack/edition-collaboration-differences.md +61 -0
- package/cabloy-docs/fullstack/frontend-metadata-to-backend.md +64 -0
- package/cabloy-docs/fullstack/introduction.md +69 -0
- package/cabloy-docs/fullstack/openapi-to-sdk.md +116 -0
- package/cabloy-docs/fullstack/quickstart.md +86 -0
- package/cabloy-docs/fullstack/vona-zova-integration.md +86 -0
- package/cabloy-docs/index.md +73 -0
- package/cabloy-docs/package.json +16 -0
- package/cabloy-docs/pnpm-lock.yaml +1607 -0
- package/cabloy-docs/reference/backend-directory-structure.md +88 -0
- package/cabloy-docs/reference/cli-reference.md +49 -0
- package/cabloy-docs/reference/glossary.md +38 -0
- package/cabloy-docs/reference/package-map.md +105 -0
- package/cabloy-docs/reference/repo-scripts.md +36 -0
- package/package.json +4 -1
- package/scripts/init.ts +12 -0
- package/scripts/upgrade.ts +31 -3
- package/vona/README.md +3 -3
- package/vona/README.zh-CN.md +4 -4
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/src/suite-vendor/a-cabloy/modules/a-datasharding/package.json +1 -1
- package/vona/src/suite-vendor/a-cabloy/modules/a-datasharding/src/bean/summerCache.datasourceWrite.ts +2 -2
- package/vona/src/suite-vendor/a-cabloy/package.json +1 -1
- package/vona/src/suite-vendor/a-captcha/modules/a-captcha/package.json +1 -1
- package/vona/src/suite-vendor/a-captcha/modules/a-captcha/src/bean/cacheRedis.captcha.ts +2 -2
- package/vona/src/suite-vendor/a-captcha/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-bean/cli/bean/metadata/generate.ts +5 -6
- package/vona/src/suite-vendor/a-vona/modules/a-bean/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-cache/cli/cacheMem/boilerplate/{{sceneName}}.{{beanName}}.ts_ +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-cache/cli/cacheRedis/boilerplate/{{sceneName}}.{{beanName}}.ts_ +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-cache/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-cache/src/.metadata/index.ts +13 -2
- package/vona/src/suite-vendor/a-vona/modules/a-cache/src/bean/bean.cache.ts +6 -7
- package/vona/src/suite-vendor/a-vona/modules/a-cache/src/{bean/bean.cacheMemBase.ts → service/cacheMemBase_.ts} +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-cache/src/{bean/bean.cacheRedisBase.ts → service/cacheRedisBase_.ts} +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-mailconfirm/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-mailconfirm/src/bean/cacheRedis.emailConfirm.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-mailconfirm/src/bean/cacheRedis.passwordReset.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-openapi/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapi/src/bean/summerCache.json.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/cli/databaseDialect/boilerplate/{{sceneName}}.{{beanName}}.ts_ +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/.metadata/index.ts +4 -3
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/bean/bean.database.ts +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/bean/bean.model.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/bean/schedule.softDeletionPrune.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/common/utils.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/index.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_cache.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_meta.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.modelBase.ts +0 -5
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoAggregate.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoCreate.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoGet.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoGroup.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoMutate.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoSelectAndCount.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoUpdate.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/modelCacheBase.ts +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/relations.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/relationsDynamic.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/relationsMutate.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/relationsStatic.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/service/cacheEntity_.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/service/cacheQuery_.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/service/database.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean/bean.databaseDialectBase.ts → service/databaseDialectBase_.ts} +38 -41
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/service/db_.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/service/relations_.ts +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/database.ts +0 -5
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/dto/dtoGet.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/dto/dtoMutate.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/dto/dtoSelectAndCount.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/model.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/modelAggr.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/modelCount.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/modelGeneral.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/modelGroup.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/modelIncrement.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relations.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relationsColumns.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relationsDef.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relationsDefDynamic.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relationsDefMutate.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relationsMutate.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relationsTables.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-ormdialect/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-ormdialect/src/bean/databaseDialect.betterSqlite3.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-ormdialect/src/bean/databaseDialect.mysql.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-ormdialect/src/bean/databaseDialect.pg.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-permission/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-permission/src/bean/bean.permission.ts +109 -40
- package/vona/src/suite-vendor/a-vona/modules/a-permission/src/bean/summerCache.permission.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-startup/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-startup/src/bean/cacheRedis.startupDebounce.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-summer/cli/boilerplate/{{sceneName}}.{{beanName}}.ts_ +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-summer/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-summer/src/.metadata/index.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-summer/src/bean/bean.summer.ts +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-summer/src/service/localMem_.ts +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-summer/src/service/localRedis_.ts +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-summer/src/{bean/bean.summerCacheBase.ts → service/summerCacheBase_.ts} +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-swagger/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-swagger/src/bean/summerCache.rapidoc.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-swagger/src/bean/summerCache.swagger.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-user/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-user/src/bean/cacheRedis.authToken.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-worker/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-worker/src/bean/cacheRedis.workerAlive.ts +2 -2
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/README.md +4 -4
- package/zova/README.zh-CN.md +4 -4
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/src/suite/a-demo/modules/demo-basic/src/page/toolTwo/controller.tsx +0 -2
- package/zova/src/suite/a-home/modules/home-base/src/config/locale/en-us.ts +1 -0
- package/zova/src/suite/a-home/modules/home-base/src/config/locale/zh-cn.ts +1 -0
- package/zova/src/suite/a-home/modules/home-base/src/page/errorNotFound/controller.tsx +8 -2
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/controller.tsx +1 -1
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.header.tsx +1 -1
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.locale.tsx +2 -5
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.tabs.tsx +1 -4
- package/zova/src/suite-vendor/a-zova/modules/a-router/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-router/src/bean/sys.router.ts +28 -6
- package/zova/src/suite-vendor/a-zova/modules/a-router/src/monkeySys.ts +15 -3
- package/zova/src/suite-vendor/a-zova/modules/a-router/src/types/router.ts +1 -0
- package/zova/src/suite-vendor/a-zova/modules/a-routertabs/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-routertabs/src/model/tabs.ts +4 -0
- package/zova/src/suite-vendor/a-zova/package.json +3 -3
- /package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_crud.ts +0 -0
- /package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_crud_inner.ts +0 -0
- /package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_crud_table.ts +0 -0
- /package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_knex.ts +0 -0
- /package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_utils.ts +0 -0
- /package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_view.ts +0 -0
|
@@ -4,28 +4,27 @@ import { Bean } from 'vona-module-a-bean';
|
|
|
4
4
|
import type { IDecoratorCacheMemOptions } from '../types/cacheMem.ts';
|
|
5
5
|
import type { IDecoratorCacheRedisOptions } from '../types/cacheRedis.ts';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
7
|
+
import { ServiceCacheMemBase } from '../service/cacheMemBase_.ts';
|
|
8
|
+
import { ServiceCacheRedisBase } from '../service/cacheRedisBase_.ts';
|
|
10
9
|
@Bean()
|
|
11
10
|
export class BeanCache extends BeanBase {
|
|
12
11
|
mem<KEY, DATA>(
|
|
13
12
|
cacheName: string,
|
|
14
13
|
cacheOptions?: IDecoratorCacheMemOptions,
|
|
15
|
-
):
|
|
14
|
+
): ServiceCacheMemBase<KEY, DATA> {
|
|
16
15
|
if (cacheName.includes('.cacheMem.')) {
|
|
17
16
|
return this.app.bean._getBeanSelector(cacheName as any, undefined, cacheOptions);
|
|
18
17
|
}
|
|
19
|
-
return this.app.bean._getBeanSelector(
|
|
18
|
+
return this.app.bean._getBeanSelector(ServiceCacheMemBase, cacheName, cacheOptions);
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
redis<KEY, DATA>(
|
|
23
22
|
cacheName: string,
|
|
24
23
|
cacheOptions?: IDecoratorCacheRedisOptions,
|
|
25
|
-
):
|
|
24
|
+
): ServiceCacheRedisBase<KEY, DATA> {
|
|
26
25
|
if (cacheName.includes('.cacheRedis.')) {
|
|
27
26
|
return this.app.bean._getBeanSelector(cacheName as any, undefined, cacheOptions);
|
|
28
27
|
}
|
|
29
|
-
return this.app.bean._getBeanSelector(
|
|
28
|
+
return this.app.bean._getBeanSelector(ServiceCacheRedisBase, cacheName, cacheOptions);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LRUCache } from 'lru-cache';
|
|
2
2
|
import { Virtual } from 'vona';
|
|
3
|
-
import {
|
|
3
|
+
import { Service } from 'vona-module-a-bean';
|
|
4
4
|
|
|
5
5
|
import type { ICacheMemGetOptions, ICacheMemSetOptions } from '../types/cache.ts';
|
|
6
6
|
import type { IDecoratorCacheMemOptions } from '../types/cacheMem.ts';
|
|
@@ -8,9 +8,9 @@ import type { IDecoratorCacheMemOptions } from '../types/cacheMem.ts';
|
|
|
8
8
|
import { CacheBase } from '../common/cacheBase.ts';
|
|
9
9
|
import { getCacheMemories } from '../lib/const.ts';
|
|
10
10
|
|
|
11
|
-
@
|
|
11
|
+
@Service()
|
|
12
12
|
@Virtual()
|
|
13
|
-
export class
|
|
13
|
+
export class ServiceCacheMemBase<KEY = any, DATA = any> extends CacheBase<
|
|
14
14
|
IDecoratorCacheMemOptions,
|
|
15
15
|
KEY
|
|
16
16
|
> {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { Redis } from 'ioredis';
|
|
2
2
|
|
|
3
3
|
import { Virtual } from 'vona';
|
|
4
|
-
import {
|
|
4
|
+
import { Service } from 'vona-module-a-bean';
|
|
5
5
|
|
|
6
6
|
import type { ICacheRedisGetOptions, ICacheRedisSetOptions } from '../types/cache.ts';
|
|
7
7
|
import type { IDecoratorCacheRedisOptions } from '../types/cacheRedis.ts';
|
|
8
8
|
|
|
9
9
|
import { CacheBase } from '../common/cacheBase.ts';
|
|
10
10
|
|
|
11
|
-
@
|
|
11
|
+
@Service()
|
|
12
12
|
@Virtual()
|
|
13
|
-
export class
|
|
13
|
+
export class ServiceCacheRedisBase<KEY = any, DATA = any> extends CacheBase<
|
|
14
14
|
IDecoratorCacheRedisOptions,
|
|
15
15
|
KEY
|
|
16
16
|
> {
|
package/vona/src/suite-vendor/a-vona/modules/a-mailconfirm/src/bean/cacheRedis.emailConfirm.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ServiceCacheRedisBase, CacheRedis } from 'vona-module-a-cache';
|
|
4
4
|
|
|
5
5
|
export type TCacheRedisEmailConfirmKey = string;
|
|
6
6
|
export interface TCacheRedisEmailConfirmData {
|
|
@@ -11,7 +11,7 @@ export interface TCacheRedisEmailConfirmData {
|
|
|
11
11
|
@CacheRedis({
|
|
12
12
|
ttl: 30 * 60 * 1000, // 30 minutes
|
|
13
13
|
})
|
|
14
|
-
export class CacheRedisEmailConfirm extends
|
|
14
|
+
export class CacheRedisEmailConfirm extends ServiceCacheRedisBase<
|
|
15
15
|
TCacheRedisEmailConfirmKey,
|
|
16
16
|
TCacheRedisEmailConfirmData
|
|
17
17
|
> {}
|
package/vona/src/suite-vendor/a-vona/modules/a-mailconfirm/src/bean/cacheRedis.passwordReset.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ServiceCacheRedisBase, CacheRedis } from 'vona-module-a-cache';
|
|
4
4
|
|
|
5
5
|
export type TCacheRedisPasswordResetKey = string;
|
|
6
6
|
export interface TCacheRedisPasswordResetData {
|
|
@@ -10,7 +10,7 @@ export interface TCacheRedisPasswordResetData {
|
|
|
10
10
|
@CacheRedis({
|
|
11
11
|
ttl: 30 * 60 * 1000, // 30 minutes
|
|
12
12
|
})
|
|
13
|
-
export class CacheRedisPasswordReset extends
|
|
13
|
+
export class CacheRedisPasswordReset extends ServiceCacheRedisBase<
|
|
14
14
|
TCacheRedisPasswordResetKey,
|
|
15
15
|
TCacheRedisPasswordResetData
|
|
16
16
|
> {}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ISummerCacheGet, TSummerCacheActionOptions } from 'vona-module-a-summer';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ServiceSummerCacheBase, SummerCache } from 'vona-module-a-summer';
|
|
4
4
|
|
|
5
5
|
export type TSummerCacheJsonKey = any;
|
|
6
6
|
export type TSummerCacheJsonData = any;
|
|
7
7
|
|
|
8
8
|
@SummerCache({ preset: 'mem' })
|
|
9
9
|
export class SummerCacheJson
|
|
10
|
-
extends
|
|
10
|
+
extends ServiceSummerCacheBase<TSummerCacheJsonKey, TSummerCacheJsonData>
|
|
11
11
|
implements ISummerCacheGet<TSummerCacheJsonKey, TSummerCacheJsonData>
|
|
12
12
|
{
|
|
13
13
|
async getNative(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IDecoratorDatabaseDialectOptions } from 'vona-module-a-orm';
|
|
2
|
-
import {
|
|
2
|
+
import { ServiceDatabaseDialectBase, DatabaseDialect } from 'vona-module-a-orm';
|
|
3
3
|
|
|
4
4
|
export interface IDatabaseDialectOptions<%=argv.beanNameCapitalize%> extends IDecoratorDatabaseDialectOptions {}
|
|
5
5
|
|
|
6
6
|
@DatabaseDialect<IDatabaseDialectOptions<%=argv.beanNameCapitalize%>>()
|
|
7
|
-
export class DatabaseDialect<%=argv.beanNameCapitalize%> extends
|
|
7
|
+
export class DatabaseDialect<%=argv.beanNameCapitalize%> extends ServiceDatabaseDialectBase {}
|
|
@@ -27,9 +27,7 @@ declare module 'vona-module-a-orm' {
|
|
|
27
27
|
/** aopMethod: end */
|
|
28
28
|
/** bean: begin */
|
|
29
29
|
export * from '../bean/bean.database.ts';
|
|
30
|
-
export * from '../bean/bean.databaseDialectBase.ts';
|
|
31
30
|
export * from '../bean/bean.model.ts';
|
|
32
|
-
export * from '../bean/bean.modelBase.ts';
|
|
33
31
|
|
|
34
32
|
import 'vona';
|
|
35
33
|
declare module 'vona' {
|
|
@@ -46,10 +44,12 @@ declare module 'vona-module-a-orm' {
|
|
|
46
44
|
/** bean: end */
|
|
47
45
|
/** bean: begin */
|
|
48
46
|
import type { BeanDatabase } from '../bean/bean.database.ts';
|
|
49
|
-
import '
|
|
47
|
+
import type { BeanModel } from '../bean/bean.model.ts';
|
|
48
|
+
import 'vona';
|
|
50
49
|
declare module 'vona' {
|
|
51
50
|
export interface IBeanRecordGlobal {
|
|
52
51
|
'database': BeanDatabase;
|
|
52
|
+
'model': BeanModel;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
/** bean: end */
|
|
@@ -61,6 +61,7 @@ export * from '../service/columns_.ts';
|
|
|
61
61
|
export * from '../service/database.ts';
|
|
62
62
|
export * from '../service/databaseAsyncLocalStorage_.ts';
|
|
63
63
|
export * from '../service/databaseClient_.ts';
|
|
64
|
+
export * from '../service/databaseDialectBase_.ts';
|
|
64
65
|
export * from '../service/db_.ts';
|
|
65
66
|
export * from '../service/entityResolver_.ts';
|
|
66
67
|
export * from '../service/modelResolver_.ts';
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
IDatabaseClientRecord,
|
|
10
10
|
IDbInfo,
|
|
11
11
|
} from '../types/database.ts';
|
|
12
|
-
import type {
|
|
12
|
+
import type { ServiceDatabaseDialectBase } from '../service/databaseDialectBase_.ts';
|
|
13
13
|
|
|
14
14
|
import { ServiceDatabaseAsyncLocalStorage } from '../service/databaseAsyncLocalStorage_.ts';
|
|
15
15
|
import { ServiceDatabaseClient } from '../service/databaseClient_.ts';
|
|
@@ -44,13 +44,13 @@ export class BeanDatabase extends BeanBase {
|
|
|
44
44
|
return this.getClient(dbInfoOrClientName, clientConfig).db;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
getDialect(client: keyof IDatabaseClientDialectRecord):
|
|
47
|
+
getDialect(client: keyof IDatabaseClientDialectRecord): ServiceDatabaseDialectBase {
|
|
48
48
|
if (!client) throw new Error('database dialect not specified');
|
|
49
49
|
const beanFullName = beanFullNameFromOnionName(
|
|
50
50
|
this.scope.config.dialects[client],
|
|
51
51
|
'databaseDialect',
|
|
52
52
|
);
|
|
53
|
-
const dialect = this.app.bean._getBean(beanFullName) as
|
|
53
|
+
const dialect = this.app.bean._getBean(beanFullName) as ServiceDatabaseDialectBase;
|
|
54
54
|
if (!dialect) throw new Error(`database dialect not found: ${client}`);
|
|
55
55
|
return dialect;
|
|
56
56
|
}
|
|
@@ -5,7 +5,7 @@ import { BeanBase } from 'vona';
|
|
|
5
5
|
import { Schedule } from 'vona-module-a-schedule';
|
|
6
6
|
|
|
7
7
|
import type { IModelRecord, ISoftDeletionPrune } from '../types/onion/model.ts';
|
|
8
|
-
import type { BeanModelCache } from '
|
|
8
|
+
import type { BeanModelCache } from '../lib/bean.model/bean.model_cache.ts';
|
|
9
9
|
|
|
10
10
|
@Schedule({ repeat: { every: 24 * 3600 * 1000 } })
|
|
11
11
|
export class ScheduleSoftDeletionPrune extends BeanBase implements IScheduleExecute {
|
|
@@ -3,7 +3,7 @@ import type { Constructable } from 'vona';
|
|
|
3
3
|
import { appResource, beanFullNameFromOnionName } from 'vona';
|
|
4
4
|
import { prepareClassType } from 'vona-module-a-openapiutils';
|
|
5
5
|
|
|
6
|
-
import type { BeanModelMeta } from '../
|
|
6
|
+
import type { BeanModelMeta } from '../lib/bean.model/bean.model_meta.ts';
|
|
7
7
|
import type { TypeModelColumn, TypeModelColumns } from '../types/modelWhere.ts';
|
|
8
8
|
import type { IDecoratorModelOptions, IModelClassRecord } from '../types/onion/model.ts';
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import 'bignumber.js';
|
|
|
3
3
|
export * from './.metadata/index.ts';
|
|
4
4
|
|
|
5
5
|
export * from './.metadata/locales.ts';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './lib/bean.model/bean.model_meta.ts';
|
|
7
7
|
export * from './common/index.ts';
|
|
8
8
|
export * from './extend/index.ts';
|
|
9
9
|
export * from './lib/index.ts';
|
package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_cache.ts
RENAMED
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
TypeModelsClassLikeGeneral,
|
|
32
32
|
TypeModelWhere,
|
|
33
33
|
} from '../../types/index.ts';
|
|
34
|
-
import type { TypeQueueDoubleDeleteJobData } from '
|
|
34
|
+
import type { TypeQueueDoubleDeleteJobData } from '../../bean/queue.doubleDelete.ts';
|
|
35
35
|
|
|
36
36
|
import { getTargetColumnName } from '../../common/utils.ts';
|
|
37
37
|
import { getCacheModelsClear } from '../../lib/const.ts';
|
package/vona/src/suite-vendor/a-vona/modules/a-orm/src/{bean → lib}/bean.model/bean.model_meta.ts
RENAMED
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
TypeModelOptionsTable,
|
|
16
16
|
TypeModelRelationOptionsMetaClient,
|
|
17
17
|
} from '../../types/index.ts';
|
|
18
|
-
import type { BeanModel } from '
|
|
18
|
+
import type { BeanModel } from '../../bean/bean.model.ts';
|
|
19
19
|
|
|
20
20
|
import { getTableOrTableAlias, prepareClassModel } from '../../common/utils.ts';
|
|
21
21
|
import { SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyModelOptions } from '../../types/index.ts';
|
|
@@ -4,7 +4,7 @@ import { ensureArray } from '@cabloy/utils';
|
|
|
4
4
|
import { Api, v } from 'vona-module-a-openapiutils';
|
|
5
5
|
import z from 'zod';
|
|
6
6
|
|
|
7
|
-
import type { BeanModelMeta } from '
|
|
7
|
+
import type { BeanModelMeta } from '../bean.model/bean.model_meta.ts';
|
|
8
8
|
import type { TypeDtoAggrResult } from '../../types/dto/dtoAggregate.ts';
|
|
9
9
|
import type { TypeModelSelectAggrParamsAggrs } from '../../types/modelAggr.ts';
|
|
10
10
|
import type { IModelClassRecord } from '../../types/onion/model.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Constructable } from 'vona';
|
|
2
2
|
|
|
3
|
-
import type { BeanModelMeta } from '
|
|
3
|
+
import type { BeanModelMeta } from '../bean.model/bean.model_meta.ts';
|
|
4
4
|
import type { IDtoMutateParams, TypeDtoMutateResult } from '../../types/dto/dtoMutate.ts';
|
|
5
5
|
import type { IModelClassRecord } from '../../types/onion/model.ts';
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from 'vona-module-a-openapiutils';
|
|
13
13
|
import z from 'zod';
|
|
14
14
|
|
|
15
|
-
import type { BeanModelMeta } from '
|
|
15
|
+
import type { BeanModelMeta } from '../bean.model/bean.model_meta.ts';
|
|
16
16
|
import type { IDtoGetParams, TypeDtoGetResult } from '../../types/dto/dtoGet.ts';
|
|
17
17
|
import type { TypeDtoMutateType } from '../../types/dto/dtoMutate.ts';
|
|
18
18
|
import type { IModelRelationIncludeWrapper } from '../../types/model.ts';
|
|
@@ -3,7 +3,7 @@ import type { Constructable } from 'vona';
|
|
|
3
3
|
import { ensureArray } from '@cabloy/utils';
|
|
4
4
|
import { PickClassInner } from 'vona';
|
|
5
5
|
|
|
6
|
-
import type { BeanModelMeta } from '
|
|
6
|
+
import type { BeanModelMeta } from '../bean.model/bean.model_meta.ts';
|
|
7
7
|
import type { TypeDtoGroupResult } from '../../types/dto/dtoGroup.ts';
|
|
8
8
|
import type { TypeModelSelectAggrParamsAggrs } from '../../types/modelAggr.ts';
|
|
9
9
|
import type { TypeModelColumnsStrict } from '../../types/modelWhere.ts';
|
|
@@ -3,7 +3,7 @@ import type { Constructable } from 'vona';
|
|
|
3
3
|
import { mutate } from 'mutate-on-copy';
|
|
4
4
|
import { $Class } from 'vona';
|
|
5
5
|
|
|
6
|
-
import type { BeanModelMeta } from '
|
|
6
|
+
import type { BeanModelMeta } from '../bean.model/bean.model_meta.ts';
|
|
7
7
|
import type {
|
|
8
8
|
IDtoMutateParams,
|
|
9
9
|
TypeDtoMutateResult,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Constructable } from 'vona';
|
|
2
2
|
|
|
3
|
-
import type { BeanModelMeta } from '
|
|
3
|
+
import type { BeanModelMeta } from '../bean.model/bean.model_meta.ts';
|
|
4
4
|
import type { IDtoGetParams } from '../../types/dto/dtoGet.ts';
|
|
5
5
|
import type { TypeDtoSelectAndCountResult } from '../../types/dto/dtoSelectAndCount.ts';
|
|
6
6
|
import type { IModelClassRecord } from '../../types/onion/model.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Constructable } from 'vona';
|
|
2
2
|
|
|
3
|
-
import type { BeanModelMeta } from '
|
|
3
|
+
import type { BeanModelMeta } from '../bean.model/bean.model_meta.ts';
|
|
4
4
|
import type { IDtoMutateParams, TypeDtoMutateResult } from '../../types/dto/dtoMutate.ts';
|
|
5
5
|
import type { IModelClassRecord } from '../../types/onion/model.ts';
|
|
6
6
|
|
|
@@ -3,6 +3,7 @@ export * from './databaseDialect.ts';
|
|
|
3
3
|
export * from './dto/index.ts';
|
|
4
4
|
export * from './entity.ts';
|
|
5
5
|
export * from './model.ts';
|
|
6
|
+
export * from './bean.modelBase.ts';
|
|
6
7
|
export * from './relations.ts';
|
|
7
8
|
export * from './relationsDynamic.ts';
|
|
8
9
|
export * from './relationsMutate.ts';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceSummerCacheBase, IDecoratorSummerCacheOptions } from 'vona-module-a-summer';
|
|
2
2
|
|
|
3
3
|
import { BeanBase, deepExtend } from 'vona';
|
|
4
4
|
|
|
5
|
-
import type { BeanModelCache } from '
|
|
5
|
+
import type { BeanModelCache } from './bean.model/bean.model_cache.ts';
|
|
6
6
|
import type { TypeModelCacheType } from '../types/model.ts';
|
|
7
7
|
import type { ITableRecord } from '../types/onion/table.ts';
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@ export class ModelCacheBase extends BeanBase {
|
|
|
25
25
|
return this.$scope.orm;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
public getInstance(table: keyof ITableRecord):
|
|
28
|
+
public getInstance(table: keyof ITableRecord): ServiceSummerCacheBase {
|
|
29
29
|
if (this.options === false) throw new Error('cache disabled');
|
|
30
30
|
const beanFullName = this._model.$beanFullName;
|
|
31
31
|
const cacheName = this.getName(table);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BeanModelMeta } from '
|
|
1
|
+
import type { BeanModelMeta } from './bean.model/bean.model_meta.ts';
|
|
2
2
|
import type { TypeModelsClassLikeGeneral } from '../types/relations.ts';
|
|
3
3
|
import type {
|
|
4
4
|
IModelRelationOptionsManyDynamic,
|
|
@@ -2,7 +2,7 @@ import type { TableIdentity } from 'table-identity';
|
|
|
2
2
|
|
|
3
3
|
import { Service } from 'vona-module-a-bean';
|
|
4
4
|
|
|
5
|
-
import type { BeanModelCache } from '../
|
|
5
|
+
import type { BeanModelCache } from '../lib/bean.model/bean.model_cache.ts';
|
|
6
6
|
import type { ITableRecord } from '../types/onion/table.ts';
|
|
7
7
|
|
|
8
8
|
import { ModelCacheBase } from '../lib/modelCacheBase.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Service } from 'vona-module-a-bean';
|
|
2
2
|
|
|
3
|
-
import type { BeanModelCache } from '../
|
|
3
|
+
import type { BeanModelCache } from '../lib/bean.model/bean.model_cache.ts';
|
|
4
4
|
import type { ITableRecord } from '../types/onion/table.ts';
|
|
5
5
|
|
|
6
6
|
import { ModelCacheBase } from '../lib/modelCacheBase.ts';
|
|
@@ -2,7 +2,7 @@ import { isNil } from '@cabloy/utils';
|
|
|
2
2
|
import { appResource, BeanBase, deepExtend } from 'vona';
|
|
3
3
|
import { Service } from 'vona-module-a-bean';
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { ServiceDatabaseDialectBase } from './databaseDialectBase_.ts';
|
|
6
6
|
import type { ConfigDatabaseClient } from '../types/config.ts';
|
|
7
7
|
import type {
|
|
8
8
|
IDatabaseClientDialectRecord,
|
|
@@ -61,7 +61,7 @@ export class ServiceDatabase extends BeanBase {
|
|
|
61
61
|
|
|
62
62
|
prepareClientNameSelector(
|
|
63
63
|
dbInfo: IDbInfo,
|
|
64
|
-
dialect:
|
|
64
|
+
dialect: ServiceDatabaseDialectBase | keyof IDatabaseClientDialectRecord,
|
|
65
65
|
) {
|
|
66
66
|
const dialect2 = typeof dialect === 'string' ? this.bean.database.getDialect(dialect) : dialect;
|
|
67
67
|
if (!dialect2.capabilities.level) return dbInfo.clientName;
|
|
@@ -3,7 +3,7 @@ import type { TableIdentity } from 'table-identity';
|
|
|
3
3
|
|
|
4
4
|
import { isNil, safeBoolean } from '@cabloy/utils';
|
|
5
5
|
import { BeanBase, Virtual } from 'vona';
|
|
6
|
-
import {
|
|
6
|
+
import { Service } from 'vona-module-a-bean';
|
|
7
7
|
|
|
8
8
|
import type { ITableColumn } from '../types/columns.ts';
|
|
9
9
|
import type { ConfigDatabaseClient } from '../types/config.ts';
|
|
@@ -14,9 +14,22 @@ import type {
|
|
|
14
14
|
TypeDatabaseDialectTableColumnsFn,
|
|
15
15
|
} from '../types/dialect.ts';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const BOOLEAN_COLUMN_TYPES = ['bit', 'bool', 'boolean'];
|
|
18
|
+
const NUMBER_COLUMN_TYPES = ['int'];
|
|
19
|
+
const TIMESTAMP_COLUMN_TYPE_PREFIXES = ['timestamp'];
|
|
20
|
+
const FLOAT_COLUMN_TYPE_PREFIXES = ['float', 'double'];
|
|
21
|
+
const INTEGER_COLUMN_TYPE_PREFIXES = [
|
|
22
|
+
'tinyint',
|
|
23
|
+
'smallint',
|
|
24
|
+
'mediumint',
|
|
25
|
+
'bigint',
|
|
26
|
+
'numeric',
|
|
27
|
+
'integer',
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
@Service()
|
|
18
31
|
@Virtual()
|
|
19
|
-
export class
|
|
32
|
+
export class ServiceDatabaseDialectBase extends BeanBase {
|
|
20
33
|
protected _capabilities?: IDatabaseDialectCapabilities;
|
|
21
34
|
protected _configBase?: Partial<ConfigDatabaseClient>;
|
|
22
35
|
|
|
@@ -75,11 +88,8 @@ export class BeanDatabaseDialectBase extends BeanBase {
|
|
|
75
88
|
}
|
|
76
89
|
|
|
77
90
|
coerceColumn(column: Knex.ColumnInfo): ITableColumn {
|
|
78
|
-
// result
|
|
79
91
|
const result = { type: column.type } as ITableColumn;
|
|
80
|
-
// coerce
|
|
81
92
|
result.default = this._coerceColumnValue(column.type, column.defaultValue);
|
|
82
|
-
// ok
|
|
83
93
|
return result;
|
|
84
94
|
}
|
|
85
95
|
|
|
@@ -111,22 +121,22 @@ export class BeanDatabaseDialectBase extends BeanBase {
|
|
|
111
121
|
datas: any[],
|
|
112
122
|
): Promise<[TableIdentity[], Knex.QueryBuilder]> {
|
|
113
123
|
if (datas.length === 0) return [[], builder];
|
|
114
|
-
if (isNil(datas[0].id)) {
|
|
115
|
-
let builderFirst: Knex.QueryBuilder | undefined = undefined;
|
|
116
|
-
const ids: TableIdentity[] = [];
|
|
117
|
-
for (const data of datas) {
|
|
118
|
-
const builder2 = builder.clone();
|
|
119
|
-
builder2.insert(data);
|
|
120
|
-
const items = await builder2;
|
|
121
|
-
ids.push(items[0]);
|
|
122
|
-
if (!builderFirst) builderFirst = builder2;
|
|
123
|
-
}
|
|
124
|
-
return [ids, builderFirst ?? builder];
|
|
125
|
-
} else {
|
|
124
|
+
if (!isNil(datas[0].id)) {
|
|
126
125
|
builder.insert(datas);
|
|
127
126
|
await builder;
|
|
128
127
|
return [datas.map(item => item.id), builder];
|
|
129
128
|
}
|
|
129
|
+
|
|
130
|
+
let builderFirst: Knex.QueryBuilder | undefined = undefined;
|
|
131
|
+
const ids: TableIdentity[] = [];
|
|
132
|
+
for (const data of datas) {
|
|
133
|
+
const builder2 = builder.clone();
|
|
134
|
+
builder2.insert(data);
|
|
135
|
+
const items = await builder2;
|
|
136
|
+
ids.push(items[0]);
|
|
137
|
+
if (!builderFirst) builderFirst = builder2;
|
|
138
|
+
}
|
|
139
|
+
return [ids, builderFirst ?? builder];
|
|
130
140
|
}
|
|
131
141
|
|
|
132
142
|
protected async insertAsPg(
|
|
@@ -134,41 +144,28 @@ export class BeanDatabaseDialectBase extends BeanBase {
|
|
|
134
144
|
datas: any[],
|
|
135
145
|
): Promise<[TableIdentity[], Knex.QueryBuilder]> {
|
|
136
146
|
if (datas.length === 0) return [[], builder];
|
|
137
|
-
if (isNil(datas[0].id)) {
|
|
138
|
-
builder.insert(datas).returning('id');
|
|
139
|
-
const items = await builder;
|
|
140
|
-
return [items.map(item => item.id), builder];
|
|
141
|
-
} else {
|
|
147
|
+
if (!isNil(datas[0].id)) {
|
|
142
148
|
builder.insert(datas);
|
|
143
149
|
await builder;
|
|
144
150
|
return [datas.map(item => item.id), builder];
|
|
145
151
|
}
|
|
152
|
+
|
|
153
|
+
builder.insert(datas).returning('id');
|
|
154
|
+
const items = await builder;
|
|
155
|
+
return [items.map(item => item.id), builder];
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
protected _coerceColumnValue(type: string, value) {
|
|
149
|
-
// null
|
|
150
159
|
if (isNil(value)) return undefined;
|
|
151
|
-
|
|
152
|
-
if (
|
|
153
|
-
if (
|
|
154
|
-
if (this._columnTypePrefixes(type, ['timestamp']) && value === 'CURRENT_TIMESTAMP')
|
|
160
|
+
if (BOOLEAN_COLUMN_TYPES.includes(type)) return safeBoolean(value);
|
|
161
|
+
if (NUMBER_COLUMN_TYPES.includes(type)) return this._safeNumber(value);
|
|
162
|
+
if (this._columnTypePrefixes(type, TIMESTAMP_COLUMN_TYPE_PREFIXES) && value === 'CURRENT_TIMESTAMP') {
|
|
155
163
|
return undefined; // new Date();
|
|
156
|
-
if (this._columnTypePrefixes(type, ['float', 'double'])) return this._safeNumber(value);
|
|
157
|
-
if (
|
|
158
|
-
this._columnTypePrefixes(type, [
|
|
159
|
-
'tinyint',
|
|
160
|
-
'smallint',
|
|
161
|
-
'mediumint',
|
|
162
|
-
'bigint',
|
|
163
|
-
'numeric',
|
|
164
|
-
'integer',
|
|
165
|
-
])
|
|
166
|
-
) {
|
|
167
|
-
return this._safeNumber(value);
|
|
168
164
|
}
|
|
165
|
+
if (this._columnTypePrefixes(type, FLOAT_COLUMN_TYPE_PREFIXES)) return this._safeNumber(value);
|
|
166
|
+
if (this._columnTypePrefixes(type, INTEGER_COLUMN_TYPE_PREFIXES)) return this._safeNumber(value);
|
|
169
167
|
// pg: NULL::character varying
|
|
170
168
|
if (value.indexOf('NULL::') === 0) return undefined;
|
|
171
|
-
// others
|
|
172
169
|
return value;
|
|
173
170
|
}
|
|
174
171
|
|
|
@@ -3,7 +3,7 @@ import type { FunctionAny } from 'vona';
|
|
|
3
3
|
import { BeanBase } from 'vona';
|
|
4
4
|
import { Service } from 'vona-module-a-bean';
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { ServiceDatabaseDialectBase } from './databaseDialectBase_.ts';
|
|
7
7
|
import type { IDatabaseClientDialectRecord, IDbInfo } from '../types/database.ts';
|
|
8
8
|
import type { ITransactionConsistencyCommitOptions } from '../types/transaction.ts';
|
|
9
9
|
import type { ServiceDatabaseClient } from './databaseClient_.ts';
|
|
@@ -63,7 +63,7 @@ export class ServiceDb extends BeanBase {
|
|
|
63
63
|
return this.client.clientConfig.client;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
get dialect():
|
|
66
|
+
get dialect(): ServiceDatabaseDialectBase {
|
|
67
67
|
return this.bean.database.getDialect(this.dialectName);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -4,9 +4,9 @@ import { isNil } from '@cabloy/utils';
|
|
|
4
4
|
import { BeanBase, cast, deepExtend } from 'vona';
|
|
5
5
|
import { Service } from 'vona-module-a-bean';
|
|
6
6
|
|
|
7
|
-
import type { BeanModelCache } from '../
|
|
8
|
-
import type { BeanModelCrud } from '../
|
|
9
|
-
import type { BeanModelMeta } from '../
|
|
7
|
+
import type { BeanModelCache } from '../lib/bean.model/bean.model_cache.ts';
|
|
8
|
+
import type { BeanModelCrud } from '../lib/bean.model/bean.model_crud.ts';
|
|
9
|
+
import type { BeanModelMeta } from '../lib/bean.model/bean.model_meta.ts';
|
|
10
10
|
import type { IModelMethodOptions, IModelRelationIncludeWrapper } from '../types/model.ts';
|
|
11
11
|
import type { IModelClassRecord } from '../types/onion/model.ts';
|
|
12
12
|
import type { TypeModelClassLike } from '../types/relations.ts';
|