@qlover/create-app 1.0.2 → 2.0.0
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/CHANGELOG.md +43 -0
- package/dist/index.cjs +9 -9
- package/dist/index.js +9 -9
- package/package.json +4 -3
- package/dist/configs/_common/.editorconfig +0 -23
- package/dist/configs/_common/.env.template +0 -13
- package/dist/configs/_common/.gitattributes +0 -2
- package/dist/configs/_common/.github/workflows/general-check.yml +0 -41
- package/dist/configs/_common/.github/workflows/release.yml +0 -81
- package/dist/configs/_common/.gitignore.template +0 -64
- package/dist/configs/_common/.husky/commit-msg +0 -3
- package/dist/configs/_common/.husky/pre-commit +0 -3
- package/dist/configs/_common/.prettierignore +0 -17
- package/dist/configs/_common/.prettierrc.js +0 -7
- package/dist/configs/_common/.vscode/extensions.json +0 -9
- package/dist/configs/_common/.vscode/react.code-snippets +0 -19
- package/dist/configs/_common/.vscode/settings.json +0 -16
- package/dist/configs/_common/commitlint.config.js +0 -10
- package/dist/configs/_common/package.json.template +0 -75
- package/dist/configs/node-lib/eslint.config.js +0 -50
- package/dist/templates/next-app/.env.template +0 -25
- package/dist/templates/next-app/.prettierignore +0 -58
- package/dist/templates/next-app/README.en.md +0 -130
- package/dist/templates/next-app/README.md +0 -130
- package/dist/templates/next-app/config/IOCIdentifier.ts +0 -74
- package/dist/templates/next-app/config/Identifier/api.ts +0 -41
- package/dist/templates/next-app/config/Identifier/common/admint.table.ts +0 -69
- package/dist/templates/next-app/config/Identifier/common/common.ts +0 -90
- package/dist/templates/next-app/config/Identifier/common/index.ts +0 -3
- package/dist/templates/next-app/config/Identifier/common/validators.ts +0 -34
- package/dist/templates/next-app/config/Identifier/index.ts +0 -3
- package/dist/templates/next-app/config/Identifier/pages/index.ts +0 -7
- package/dist/templates/next-app/config/Identifier/pages/page.about.ts +0 -20
- package/dist/templates/next-app/config/Identifier/pages/page.admin.home.ts +0 -27
- package/dist/templates/next-app/config/Identifier/pages/page.admin.locales.ts +0 -266
- package/dist/templates/next-app/config/Identifier/pages/page.admin.user.ts +0 -293
- package/dist/templates/next-app/config/Identifier/pages/page.home.ts +0 -56
- package/dist/templates/next-app/config/Identifier/pages/page.login.ts +0 -159
- package/dist/templates/next-app/config/Identifier/pages/page.register.ts +0 -177
- package/dist/templates/next-app/config/adminNavs.ts +0 -19
- package/dist/templates/next-app/config/common.ts +0 -43
- package/dist/templates/next-app/config/cookies.ts +0 -23
- package/dist/templates/next-app/config/i18n/AboutI18n.ts +0 -14
- package/dist/templates/next-app/config/i18n/HomeI18n.ts +0 -24
- package/dist/templates/next-app/config/i18n/PageI18nInterface.ts +0 -51
- package/dist/templates/next-app/config/i18n/admin18n.ts +0 -75
- package/dist/templates/next-app/config/i18n/i18nConfig.ts +0 -16
- package/dist/templates/next-app/config/i18n/i18nKeyScheam.ts +0 -36
- package/dist/templates/next-app/config/i18n/index.ts +0 -7
- package/dist/templates/next-app/config/i18n/loginI18n.ts +0 -50
- package/dist/templates/next-app/config/i18n/register18n.ts +0 -44
- package/dist/templates/next-app/config/route.ts +0 -9
- package/dist/templates/next-app/config/theme.ts +0 -28
- package/dist/templates/next-app/docs/en/api.md +0 -387
- package/dist/templates/next-app/docs/en/component.md +0 -544
- package/dist/templates/next-app/docs/en/database.md +0 -496
- package/dist/templates/next-app/docs/en/development-guide.md +0 -727
- package/dist/templates/next-app/docs/en/env.md +0 -563
- package/dist/templates/next-app/docs/en/i18n.md +0 -287
- package/dist/templates/next-app/docs/en/index.md +0 -165
- package/dist/templates/next-app/docs/en/page.md +0 -457
- package/dist/templates/next-app/docs/en/project-structure.md +0 -176
- package/dist/templates/next-app/docs/en/router.md +0 -427
- package/dist/templates/next-app/docs/en/theme.md +0 -532
- package/dist/templates/next-app/docs/en/validator.md +0 -478
- package/dist/templates/next-app/docs/zh/api.md +0 -387
- package/dist/templates/next-app/docs/zh/component.md +0 -544
- package/dist/templates/next-app/docs/zh/database.md +0 -496
- package/dist/templates/next-app/docs/zh/development-guide.md +0 -727
- package/dist/templates/next-app/docs/zh/env.md +0 -563
- package/dist/templates/next-app/docs/zh/i18n.md +0 -287
- package/dist/templates/next-app/docs/zh/index.md +0 -165
- package/dist/templates/next-app/docs/zh/page.md +0 -457
- package/dist/templates/next-app/docs/zh/project-structure.md +0 -176
- package/dist/templates/next-app/docs/zh/router.md +0 -427
- package/dist/templates/next-app/docs/zh/theme.md +0 -532
- package/dist/templates/next-app/docs/zh/validator.md +0 -476
- package/dist/templates/next-app/eslint.config.mjs +0 -285
- package/dist/templates/next-app/make/generateLocales.ts +0 -32
- package/dist/templates/next-app/migrations/schema/LocalesSchema.ts +0 -15
- package/dist/templates/next-app/migrations/schema/UserSchema.ts +0 -38
- package/dist/templates/next-app/migrations/sql/1694244000000.sql +0 -21
- package/dist/templates/next-app/next.config.ts +0 -25
- package/dist/templates/next-app/package.json +0 -87
- package/dist/templates/next-app/postcss.config.mjs +0 -5
- package/dist/templates/next-app/public/favicon.ico +0 -0
- package/dist/templates/next-app/public/file.svg +0 -1
- package/dist/templates/next-app/public/globe.svg +0 -1
- package/dist/templates/next-app/public/locales/en.json +0 -182
- package/dist/templates/next-app/public/locales/zh.json +0 -182
- package/dist/templates/next-app/public/next.svg +0 -1
- package/dist/templates/next-app/public/vercel.svg +0 -1
- package/dist/templates/next-app/public/window.svg +0 -1
- package/dist/templates/next-app/src/app/[locale]/admin/AdminI18nProvider.tsx +0 -37
- package/dist/templates/next-app/src/app/[locale]/admin/layout.tsx +0 -42
- package/dist/templates/next-app/src/app/[locale]/admin/locales/page.tsx +0 -153
- package/dist/templates/next-app/src/app/[locale]/admin/page.tsx +0 -20
- package/dist/templates/next-app/src/app/[locale]/admin/users/page.tsx +0 -67
- package/dist/templates/next-app/src/app/[locale]/auth/layout.tsx +0 -18
- package/dist/templates/next-app/src/app/[locale]/auth/login/LoginForm.tsx +0 -126
- package/dist/templates/next-app/src/app/[locale]/auth/login/page.tsx +0 -90
- package/dist/templates/next-app/src/app/[locale]/auth/page.tsx +0 -8
- package/dist/templates/next-app/src/app/[locale]/auth/register/RegisterForm.tsx +0 -197
- package/dist/templates/next-app/src/app/[locale]/auth/register/page.tsx +0 -90
- package/dist/templates/next-app/src/app/[locale]/layout.tsx +0 -63
- package/dist/templates/next-app/src/app/[locale]/not-found.tsx +0 -24
- package/dist/templates/next-app/src/app/[locale]/page.tsx +0 -98
- package/dist/templates/next-app/src/app/api/admin/locales/create/route.ts +0 -13
- package/dist/templates/next-app/src/app/api/admin/locales/import/route.ts +0 -13
- package/dist/templates/next-app/src/app/api/admin/locales/route.ts +0 -20
- package/dist/templates/next-app/src/app/api/admin/locales/update/route.ts +0 -13
- package/dist/templates/next-app/src/app/api/admin/users/route.ts +0 -20
- package/dist/templates/next-app/src/app/api/ai/completions/route.ts +0 -32
- package/dist/templates/next-app/src/app/api/auth/callback/route.ts +0 -11
- package/dist/templates/next-app/src/app/api/callback/route.ts +0 -49
- package/dist/templates/next-app/src/app/api/locales/json/route.ts +0 -33
- package/dist/templates/next-app/src/app/api/user/login/route.ts +0 -10
- package/dist/templates/next-app/src/app/api/user/logout/route.ts +0 -8
- package/dist/templates/next-app/src/app/api/user/register/route.ts +0 -11
- package/dist/templates/next-app/src/app/manifest.ts +0 -16
- package/dist/templates/next-app/src/app/robots.txt +0 -2
- package/dist/templates/next-app/src/base/cases/AdminPageManager.ts +0 -28
- package/dist/templates/next-app/src/base/cases/AppConfig.ts +0 -40
- package/dist/templates/next-app/src/base/cases/Datetime.ts +0 -18
- package/dist/templates/next-app/src/base/cases/DialogErrorPlugin.ts +0 -57
- package/dist/templates/next-app/src/base/cases/DialogHandler.ts +0 -116
- package/dist/templates/next-app/src/base/cases/InversifyContainer.ts +0 -45
- package/dist/templates/next-app/src/base/cases/NavigateBridge.ts +0 -32
- package/dist/templates/next-app/src/base/cases/RequestEncryptPlugin.ts +0 -77
- package/dist/templates/next-app/src/base/cases/ResourceState.ts +0 -17
- package/dist/templates/next-app/src/base/cases/RouterService.ts +0 -52
- package/dist/templates/next-app/src/base/cases/StringEncryptor.ts +0 -73
- package/dist/templates/next-app/src/base/cases/TranslateI18nUtil.ts +0 -53
- package/dist/templates/next-app/src/base/cases/ZodColumnBuilder.ts +0 -212
- package/dist/templates/next-app/src/base/port/AdminLayoutInterface.ts +0 -26
- package/dist/templates/next-app/src/base/port/AppApiInterface.ts +0 -36
- package/dist/templates/next-app/src/base/port/AppUserApiInterface.ts +0 -27
- package/dist/templates/next-app/src/base/port/I18nServiceInterface.ts +0 -25
- package/dist/templates/next-app/src/base/port/IOCInterface.ts +0 -33
- package/dist/templates/next-app/src/base/port/RouterInterface.ts +0 -11
- package/dist/templates/next-app/src/base/port/UserServiceInterface.ts +0 -25
- package/dist/templates/next-app/src/base/port/ZodBuilderInterface.ts +0 -8
- package/dist/templates/next-app/src/base/services/AdminPageEvent.ts +0 -26
- package/dist/templates/next-app/src/base/services/AdminPageScheduler.ts +0 -42
- package/dist/templates/next-app/src/base/services/AppApiRequester.ts +0 -67
- package/dist/templates/next-app/src/base/services/AppUserGateway.ts +0 -110
- package/dist/templates/next-app/src/base/services/I18nService.ts +0 -87
- package/dist/templates/next-app/src/base/services/ResourceService.ts +0 -139
- package/dist/templates/next-app/src/base/services/UserService.ts +0 -68
- package/dist/templates/next-app/src/base/services/adminApi/AdminLocalesApi.ts +0 -106
- package/dist/templates/next-app/src/base/services/adminApi/AdminUserApi.ts +0 -87
- package/dist/templates/next-app/src/base/services/appApi/AppApiPlugin.ts +0 -110
- package/dist/templates/next-app/src/base/services/appApi/AppUserApiBootstrap.ts +0 -52
- package/dist/templates/next-app/src/base/types/AppPageRouter.ts +0 -12
- package/dist/templates/next-app/src/base/types/PagesRouter.ts +0 -9
- package/dist/templates/next-app/src/core/bootstraps/BootstrapClient.ts +0 -76
- package/dist/templates/next-app/src/core/bootstraps/BootstrapServer.ts +0 -125
- package/dist/templates/next-app/src/core/bootstraps/BootstrapsRegistry.ts +0 -50
- package/dist/templates/next-app/src/core/bootstraps/IocIdentifierTest.ts +0 -26
- package/dist/templates/next-app/src/core/bootstraps/PrintBootstrap.ts +0 -18
- package/dist/templates/next-app/src/core/clientIoc/ClientIOC.ts +0 -68
- package/dist/templates/next-app/src/core/clientIoc/ClientIOCRegister.ts +0 -100
- package/dist/templates/next-app/src/core/globals.ts +0 -28
- package/dist/templates/next-app/src/core/serverIoc/ServerIOC.ts +0 -80
- package/dist/templates/next-app/src/core/serverIoc/ServerIOCRegister.ts +0 -66
- package/dist/templates/next-app/src/i18n/loadMessages.ts +0 -103
- package/dist/templates/next-app/src/i18n/request.ts +0 -31
- package/dist/templates/next-app/src/i18n/routing.ts +0 -35
- package/dist/templates/next-app/src/lib/supabase/client.ts +0 -8
- package/dist/templates/next-app/src/lib/supabase/conts.ts +0 -2
- package/dist/templates/next-app/src/lib/supabase/proxy.ts +0 -84
- package/dist/templates/next-app/src/lib/supabase/server.ts +0 -38
- package/dist/templates/next-app/src/pages/[locale]/about.tsx +0 -61
- package/dist/templates/next-app/src/pages/_app.tsx +0 -50
- package/dist/templates/next-app/src/pages/_document.tsx +0 -13
- package/dist/templates/next-app/src/proxy.ts +0 -33
- package/dist/templates/next-app/src/server/AppErrorApi.ts +0 -10
- package/dist/templates/next-app/src/server/AppPageRouteParams.ts +0 -110
- package/dist/templates/next-app/src/server/AppSuccessApi.ts +0 -7
- package/dist/templates/next-app/src/server/NextApiServer.ts +0 -61
- package/dist/templates/next-app/src/server/PagesRouteParams.ts +0 -145
- package/dist/templates/next-app/src/server/PasswordEncrypt.ts +0 -18
- package/dist/templates/next-app/src/server/ServerAuth.ts +0 -81
- package/dist/templates/next-app/src/server/SupabaseBridge.ts +0 -262
- package/dist/templates/next-app/src/server/UserCredentialToken.ts +0 -53
- package/dist/templates/next-app/src/server/controllers/AdminLocalesController.ts +0 -86
- package/dist/templates/next-app/src/server/controllers/AdminUserController.ts +0 -42
- package/dist/templates/next-app/src/server/controllers/LocalesController.ts +0 -36
- package/dist/templates/next-app/src/server/controllers/UserController.ts +0 -91
- package/dist/templates/next-app/src/server/port/AIControllerInterface.ts +0 -8
- package/dist/templates/next-app/src/server/port/AdminLocalesControllerInterface.ts +0 -21
- package/dist/templates/next-app/src/server/port/AdminUserControllerInterface.ts +0 -11
- package/dist/templates/next-app/src/server/port/CrentialTokenInterface.ts +0 -5
- package/dist/templates/next-app/src/server/port/DBBridgeInterface.ts +0 -36
- package/dist/templates/next-app/src/server/port/DBTableInterface.ts +0 -12
- package/dist/templates/next-app/src/server/port/LocalesControllerInterface.ts +0 -10
- package/dist/templates/next-app/src/server/port/LocalesRepositoryInterface.ts +0 -43
- package/dist/templates/next-app/src/server/port/PaginationInterface.ts +0 -6
- package/dist/templates/next-app/src/server/port/RouteParamsnHandlerInterface.ts +0 -18
- package/dist/templates/next-app/src/server/port/ServerAuthInterface.ts +0 -15
- package/dist/templates/next-app/src/server/port/ServerInterface.ts +0 -23
- package/dist/templates/next-app/src/server/port/UserRepositoryInterface.ts +0 -15
- package/dist/templates/next-app/src/server/port/UserServiceInterface.ts +0 -14
- package/dist/templates/next-app/src/server/port/ValidatorInterface.ts +0 -23
- package/dist/templates/next-app/src/server/repositorys/LocalesRepository.ts +0 -216
- package/dist/templates/next-app/src/server/repositorys/UserRepository.ts +0 -102
- package/dist/templates/next-app/src/server/services/AIService.ts +0 -45
- package/dist/templates/next-app/src/server/services/AdminAuthPlugin.ts +0 -21
- package/dist/templates/next-app/src/server/services/AdminLocalesService.ts +0 -20
- package/dist/templates/next-app/src/server/services/ApiLocaleService.ts +0 -137
- package/dist/templates/next-app/src/server/services/ApiUserService.ts +0 -29
- package/dist/templates/next-app/src/server/services/UserService.ts +0 -134
- package/dist/templates/next-app/src/server/validators/ExtendedExecutorError.ts +0 -6
- package/dist/templates/next-app/src/server/validators/LocalesValidator.ts +0 -145
- package/dist/templates/next-app/src/server/validators/LoginValidator.ts +0 -82
- package/dist/templates/next-app/src/server/validators/PaginationValidator.ts +0 -70
- package/dist/templates/next-app/src/server/validators/SignupVerifyValidator.ts +0 -68
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/_default.css +0 -280
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/dark.css +0 -233
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/antd-themes/_common/pink.css +0 -246
- package/dist/templates/next-app/src/styles/css/antd-themes/index.css +0 -4
- package/dist/templates/next-app/src/styles/css/antd-themes/menu/_default.css +0 -108
- package/dist/templates/next-app/src/styles/css/antd-themes/menu/dark.css +0 -67
- package/dist/templates/next-app/src/styles/css/antd-themes/menu/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/antd-themes/menu/pink.css +0 -67
- package/dist/templates/next-app/src/styles/css/antd-themes/no-context.css +0 -34
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/_default.css +0 -34
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/dark.css +0 -31
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/pink.css +0 -36
- package/dist/templates/next-app/src/styles/css/antd-themes/table/_default.css +0 -44
- package/dist/templates/next-app/src/styles/css/antd-themes/table/dark.css +0 -43
- package/dist/templates/next-app/src/styles/css/antd-themes/table/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/antd-themes/table/pink.css +0 -43
- package/dist/templates/next-app/src/styles/css/index.css +0 -6
- package/dist/templates/next-app/src/styles/css/page.css +0 -20
- package/dist/templates/next-app/src/styles/css/scrollbar.css +0 -34
- package/dist/templates/next-app/src/styles/css/tailwind.css +0 -5
- package/dist/templates/next-app/src/styles/css/themes/_default.css +0 -30
- package/dist/templates/next-app/src/styles/css/themes/dark.css +0 -30
- package/dist/templates/next-app/src/styles/css/themes/index.css +0 -3
- package/dist/templates/next-app/src/styles/css/themes/pink.css +0 -30
- package/dist/templates/next-app/src/styles/css/zIndex.css +0 -9
- package/dist/templates/next-app/src/uikit/components/AdminLayout.tsx +0 -150
- package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +0 -39
- package/dist/templates/next-app/src/uikit/components/ClientRootProvider.tsx +0 -64
- package/dist/templates/next-app/src/uikit/components/ClientSeo.tsx +0 -36
- package/dist/templates/next-app/src/uikit/components/ClinetRenderProvider.tsx +0 -42
- package/dist/templates/next-app/src/uikit/components/EditableCell.tsx +0 -118
- package/dist/templates/next-app/src/uikit/components/FeatureItem.tsx +0 -13
- package/dist/templates/next-app/src/uikit/components/IOCProvider.tsx +0 -34
- package/dist/templates/next-app/src/uikit/components/LocaleLink.tsx +0 -50
- package/dist/templates/next-app/src/uikit/components/With.tsx +0 -17
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportButton.tsx +0 -62
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportEvent.ts +0 -28
- package/dist/templates/next-app/src/uikit/components/localesImportButton/import.module.css +0 -6
- package/dist/templates/next-app/src/uikit/components-app/AdminButton.tsx +0 -29
- package/dist/templates/next-app/src/uikit/components-app/AppBridge.tsx +0 -17
- package/dist/templates/next-app/src/uikit/components-app/AppRoutePage.tsx +0 -105
- package/dist/templates/next-app/src/uikit/components-app/AuthButton.tsx +0 -20
- package/dist/templates/next-app/src/uikit/components-app/LanguageSwitcher.tsx +0 -75
- package/dist/templates/next-app/src/uikit/components-app/LogoutButton.tsx +0 -45
- package/dist/templates/next-app/src/uikit/components-app/ThemeSwitcher.tsx +0 -144
- package/dist/templates/next-app/src/uikit/components-pages/LanguageSwitcher.tsx +0 -98
- package/dist/templates/next-app/src/uikit/components-pages/PagesRoutePage.tsx +0 -93
- package/dist/templates/next-app/src/uikit/context/IOCContext.ts +0 -25
- package/dist/templates/next-app/src/uikit/hook/useI18nInterface.ts +0 -22
- package/dist/templates/next-app/src/uikit/hook/useIOC.ts +0 -37
- package/dist/templates/next-app/src/uikit/hook/useStrictEffect.ts +0 -32
- package/dist/templates/next-app/src/uikit/hook/useWarnTranslations.ts +0 -11
- package/dist/templates/next-app/src/uikit/utils/getHashParams.ts +0 -8
- package/dist/templates/next-app/src/uikit/utils/getHashVerifyEmailParams.ts +0 -42
- package/dist/templates/next-app/tailwind.config.ts +0 -8
- package/dist/templates/next-app/tsconfig.json +0 -39
- package/dist/templates/node-lib/__tests__/readJson.test.ts +0 -26
- package/dist/templates/node-lib/bin/test.js +0 -30
- package/dist/templates/node-lib/package.json +0 -66
- package/dist/templates/node-lib/rollup.config.js +0 -79
- package/dist/templates/node-lib/src/index.ts +0 -7
- package/dist/templates/node-lib/src/readJson.ts +0 -12
- package/dist/templates/node-lib/tsconfig.json +0 -23
- package/dist/templates/pack-app/README.md +0 -108
- package/dist/templates/pack-app/eslint.config.js +0 -97
- package/dist/templates/pack-app/fe-config.json +0 -35
- package/dist/templates/pack-app/package.json +0 -86
- package/dist/templates/pack-app/pnpm-workspace.yaml +0 -2
- package/dist/templates/pack-app/tsconfig.json +0 -9
- package/dist/templates/pack-app/tsconfig.test.json +0 -10
- package/dist/templates/pack-app/vite.config.ts +0 -14
- package/dist/templates/react-app/.env.template +0 -22
- package/dist/templates/react-app/.prettierignore +0 -17
- package/dist/templates/react-app/README.en.md +0 -274
- package/dist/templates/react-app/README.md +0 -273
- package/dist/templates/react-app/__tests__/__mocks__/BootstrapTest.ts +0 -16
- package/dist/templates/react-app/__tests__/__mocks__/MockAppConfig.ts +0 -48
- package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +0 -17
- package/dist/templates/react-app/__tests__/__mocks__/MockLogger.ts +0 -14
- package/dist/templates/react-app/__tests__/__mocks__/components/TestApp.tsx +0 -38
- package/dist/templates/react-app/__tests__/__mocks__/components/TestBootstrapsProvider.tsx +0 -53
- package/dist/templates/react-app/__tests__/__mocks__/components/TestRouter.tsx +0 -46
- package/dist/templates/react-app/__tests__/__mocks__/components/index.ts +0 -12
- package/dist/templates/react-app/__tests__/__mocks__/createMockGlobals.ts +0 -96
- package/dist/templates/react-app/__tests__/__mocks__/i18nextHttpBackend.ts +0 -110
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOC.ts +0 -55
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOCRegister.ts +0 -74
- package/dist/templates/react-app/__tests__/setup/index.ts +0 -1
- package/dist/templates/react-app/__tests__/setup/setupGlobal.ts +0 -64
- package/dist/templates/react-app/__tests__/src/App.structure.test.tsx +0 -115
- package/dist/templates/react-app/__tests__/src/base/cases/AppConfig.test.ts +0 -288
- package/dist/templates/react-app/__tests__/src/base/cases/DialogHandler.test.ts +0 -226
- package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +0 -178
- package/dist/templates/react-app/__tests__/src/base/cases/InversifyContainer.test.ts +0 -181
- package/dist/templates/react-app/__tests__/src/base/cases/PublicAssetsPath.test.ts +0 -61
- package/dist/templates/react-app/__tests__/src/base/cases/RequestLogger.test.ts +0 -177
- package/dist/templates/react-app/__tests__/src/base/cases/RequestStatusCatcher.test.ts +0 -191
- package/dist/templates/react-app/__tests__/src/base/cases/RouterLoader.test.ts +0 -245
- package/dist/templates/react-app/__tests__/src/base/services/I18nService.test.ts +0 -240
- package/dist/templates/react-app/__tests__/src/core/IOC.test.ts +0 -242
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapClient.test.ts +0 -135
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapsApp.test.ts +0 -74
- package/dist/templates/react-app/__tests__/src/main.test.tsx +0 -46
- package/dist/templates/react-app/__tests__/src/uikit/components/BaseHeader.test.tsx +0 -97
- package/dist/templates/react-app/__tests__/src/uikit/components/chatMessage/ChatRoot.test.tsx +0 -274
- package/dist/templates/react-app/config/IOCIdentifier.ts +0 -91
- package/dist/templates/react-app/config/Identifier/common/common.error.ts +0 -34
- package/dist/templates/react-app/config/Identifier/common/common.ts +0 -62
- package/dist/templates/react-app/config/Identifier/common/index.ts +0 -2
- package/dist/templates/react-app/config/Identifier/components/component.chatMessage.ts +0 -56
- package/dist/templates/react-app/config/Identifier/components/component.messageBaseList.ts +0 -103
- package/dist/templates/react-app/config/Identifier/index.ts +0 -2
- package/dist/templates/react-app/config/Identifier/pages/index.ts +0 -9
- package/dist/templates/react-app/config/Identifier/pages/page.about.ts +0 -189
- package/dist/templates/react-app/config/Identifier/pages/page.executor.ts +0 -275
- package/dist/templates/react-app/config/Identifier/pages/page.home.ts +0 -71
- package/dist/templates/react-app/config/Identifier/pages/page.identifiter.ts +0 -102
- package/dist/templates/react-app/config/Identifier/pages/page.jsonStorage.ts +0 -77
- package/dist/templates/react-app/config/Identifier/pages/page.login.ts +0 -162
- package/dist/templates/react-app/config/Identifier/pages/page.message.ts +0 -20
- package/dist/templates/react-app/config/Identifier/pages/page.register.ts +0 -159
- package/dist/templates/react-app/config/Identifier/pages/page.request.ts +0 -169
- package/dist/templates/react-app/config/app.router.ts +0 -338
- package/dist/templates/react-app/config/common.ts +0 -85
- package/dist/templates/react-app/config/feapi.mock.json +0 -34
- package/dist/templates/react-app/config/i18n/PageI18nInterface.ts +0 -51
- package/dist/templates/react-app/config/i18n/aboutI18n.ts +0 -42
- package/dist/templates/react-app/config/i18n/chatMessageI18n.ts +0 -17
- package/dist/templates/react-app/config/i18n/executorI18n.ts +0 -51
- package/dist/templates/react-app/config/i18n/homeI18n.ts +0 -24
- package/dist/templates/react-app/config/i18n/i18nConfig.ts +0 -30
- package/dist/templates/react-app/config/i18n/identifiter18n.ts +0 -30
- package/dist/templates/react-app/config/i18n/jsonStorage18n.ts +0 -27
- package/dist/templates/react-app/config/i18n/login18n.ts +0 -42
- package/dist/templates/react-app/config/i18n/messageBaseListI18n.ts +0 -22
- package/dist/templates/react-app/config/i18n/messageI18n.ts +0 -14
- package/dist/templates/react-app/config/i18n/notFoundI18n.ts +0 -34
- package/dist/templates/react-app/config/i18n/register18n.ts +0 -40
- package/dist/templates/react-app/config/i18n/request18n.ts +0 -41
- package/dist/templates/react-app/config/theme.ts +0 -21
- package/dist/templates/react-app/docs/en/bootstrap.md +0 -1891
- package/dist/templates/react-app/docs/en/components/chat-message-component.md +0 -320
- package/dist/templates/react-app/docs/en/components/chat-message-refactor.md +0 -283
- package/dist/templates/react-app/docs/en/components/message-base-list-component.md +0 -171
- package/dist/templates/react-app/docs/en/development-guide.md +0 -1199
- package/dist/templates/react-app/docs/en/env.md +0 -1336
- package/dist/templates/react-app/docs/en/global.md +0 -509
- package/dist/templates/react-app/docs/en/i18n.md +0 -979
- package/dist/templates/react-app/docs/en/index.md +0 -802
- package/dist/templates/react-app/docs/en/ioc.md +0 -1365
- package/dist/templates/react-app/docs/en/playwright/e2e-tests.md +0 -321
- package/dist/templates/react-app/docs/en/playwright/index.md +0 -19
- package/dist/templates/react-app/docs/en/playwright/installation-summary.md +0 -332
- package/dist/templates/react-app/docs/en/playwright/overview.md +0 -222
- package/dist/templates/react-app/docs/en/playwright/quickstart.md +0 -325
- package/dist/templates/react-app/docs/en/playwright/reorganization-notes.md +0 -340
- package/dist/templates/react-app/docs/en/playwright/setup-complete.md +0 -290
- package/dist/templates/react-app/docs/en/playwright/testing-guide.md +0 -565
- package/dist/templates/react-app/docs/en/request.md +0 -423
- package/dist/templates/react-app/docs/en/router.md +0 -404
- package/dist/templates/react-app/docs/en/store.md +0 -1331
- package/dist/templates/react-app/docs/en/test-guide.md +0 -976
- package/dist/templates/react-app/docs/en/theme.md +0 -424
- package/dist/templates/react-app/docs/en/typescript-guide.md +0 -473
- package/dist/templates/react-app/docs/en/why-no-globals.md +0 -797
- package/dist/templates/react-app/docs/zh/bootstrap.md +0 -1891
- package/dist/templates/react-app/docs/zh/components/chat-message-component.md +0 -320
- package/dist/templates/react-app/docs/zh/components/chat-message-refactor.md +0 -283
- package/dist/templates/react-app/docs/zh/components/message-base-list-component.md +0 -171
- package/dist/templates/react-app/docs/zh/development-guide.md +0 -1199
- package/dist/templates/react-app/docs/zh/env.md +0 -1336
- package/dist/templates/react-app/docs/zh/global.md +0 -511
- package/dist/templates/react-app/docs/zh/i18n.md +0 -979
- package/dist/templates/react-app/docs/zh/index.md +0 -786
- package/dist/templates/react-app/docs/zh/ioc.md +0 -1364
- package/dist/templates/react-app/docs/zh/playwright/e2e-tests.md +0 -321
- package/dist/templates/react-app/docs/zh/playwright/index.md +0 -19
- package/dist/templates/react-app/docs/zh/playwright/installation-summary.md +0 -332
- package/dist/templates/react-app/docs/zh/playwright/overview.md +0 -222
- package/dist/templates/react-app/docs/zh/playwright/quickstart.md +0 -325
- package/dist/templates/react-app/docs/zh/playwright/reorganization-notes.md +0 -340
- package/dist/templates/react-app/docs/zh/playwright/setup-complete.md +0 -290
- package/dist/templates/react-app/docs/zh/playwright/testing-guide.md +0 -565
- package/dist/templates/react-app/docs/zh/request.md +0 -427
- package/dist/templates/react-app/docs/zh/router.md +0 -408
- package/dist/templates/react-app/docs/zh/store.md +0 -1329
- package/dist/templates/react-app/docs/zh/test-guide.md +0 -976
- package/dist/templates/react-app/docs/zh/theme.md +0 -424
- package/dist/templates/react-app/docs/zh/typescript-guide.md +0 -473
- package/dist/templates/react-app/docs/zh/why-no-globals.md +0 -797
- package/dist/templates/react-app/e2e/App.spec.ts +0 -319
- package/dist/templates/react-app/e2e/fixtures/base.fixture.ts +0 -40
- package/dist/templates/react-app/e2e/main.spec.ts +0 -20
- package/dist/templates/react-app/e2e/utils/test-helpers.ts +0 -19
- package/dist/templates/react-app/eslint.config.mjs +0 -325
- package/dist/templates/react-app/index.html +0 -13
- package/dist/templates/react-app/makes/generateTs2LocalesOptions.ts +0 -26
- package/dist/templates/react-app/package.json +0 -125
- package/dist/templates/react-app/playwright.config.ts +0 -79
- package/dist/templates/react-app/postcss.config.js +0 -5
- package/dist/templates/react-app/public/locales/en/common.json +0 -235
- package/dist/templates/react-app/public/locales/zh/common.json +0 -235
- package/dist/templates/react-app/public/logo.svg +0 -1
- package/dist/templates/react-app/public/router-root/logo.svg +0 -1
- package/dist/templates/react-app/src/App.tsx +0 -35
- package/dist/templates/react-app/src/assets/react.svg +0 -1
- package/dist/templates/react-app/src/base/apis/AiApi.ts +0 -68
- package/dist/templates/react-app/src/base/apis/feApi/FeApi.ts +0 -29
- package/dist/templates/react-app/src/base/apis/feApi/FeApiAdapter.ts +0 -14
- package/dist/templates/react-app/src/base/apis/feApi/FeApiBootstarp.ts +0 -86
- package/dist/templates/react-app/src/base/apis/feApi/FeApiType.ts +0 -21
- package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +0 -142
- package/dist/templates/react-app/src/base/apis/userApi/UserApiAdapter.ts +0 -14
- package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +0 -86
- package/dist/templates/react-app/src/base/apis/userApi/UserApiType.ts +0 -70
- package/dist/templates/react-app/src/base/cases/AppConfig.ts +0 -123
- package/dist/templates/react-app/src/base/cases/DialogHandler.ts +0 -115
- package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +0 -64
- package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +0 -45
- package/dist/templates/react-app/src/base/cases/PublicAssetsPath.ts +0 -23
- package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +0 -55
- package/dist/templates/react-app/src/base/cases/RequestLogger.ts +0 -80
- package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +0 -40
- package/dist/templates/react-app/src/base/cases/ResourceState.ts +0 -23
- package/dist/templates/react-app/src/base/cases/RouterLoader.ts +0 -173
- package/dist/templates/react-app/src/base/cases/TranslateI18nInterface.ts +0 -26
- package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +0 -23
- package/dist/templates/react-app/src/base/port/I18nServiceInterface.ts +0 -10
- package/dist/templates/react-app/src/base/port/IOCInterface.ts +0 -38
- package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +0 -21
- package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +0 -23
- package/dist/templates/react-app/src/base/port/RequestStatusInterface.ts +0 -5
- package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +0 -29
- package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +0 -20
- package/dist/templates/react-app/src/base/services/BaseLayoutService.ts +0 -61
- package/dist/templates/react-app/src/base/services/I18nService.ts +0 -146
- package/dist/templates/react-app/src/base/services/IdentifierService.ts +0 -162
- package/dist/templates/react-app/src/base/services/RouteService.ts +0 -115
- package/dist/templates/react-app/src/base/services/UserBootstrap.ts +0 -45
- package/dist/templates/react-app/src/base/services/UserService.ts +0 -88
- package/dist/templates/react-app/src/base/types/Page.ts +0 -47
- package/dist/templates/react-app/src/base/types/deprecated-antd.d.ts +0 -60
- package/dist/templates/react-app/src/base/types/global.d.ts +0 -8
- package/dist/templates/react-app/src/core/IOC.ts +0 -28
- package/dist/templates/react-app/src/core/bootstraps/BootstrapClient.ts +0 -108
- package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +0 -54
- package/dist/templates/react-app/src/core/bootstraps/IocIdentifierTest.ts +0 -26
- package/dist/templates/react-app/src/core/bootstraps/PrintBootstrap.ts +0 -14
- package/dist/templates/react-app/src/core/bootstraps/SaveAppInfo.ts +0 -28
- package/dist/templates/react-app/src/core/clientIoc/ClientIOC.ts +0 -47
- package/dist/templates/react-app/src/core/clientIoc/ClientIOCRegister.ts +0 -142
- package/dist/templates/react-app/src/core/globals.ts +0 -47
- package/dist/templates/react-app/src/main.tsx +0 -19
- package/dist/templates/react-app/src/pages/404.tsx +0 -19
- package/dist/templates/react-app/src/pages/500.tsx +0 -18
- package/dist/templates/react-app/src/pages/NoRouteFound.tsx +0 -5
- package/dist/templates/react-app/src/pages/auth/Layout.tsx +0 -27
- package/dist/templates/react-app/src/pages/auth/LoginPage.tsx +0 -166
- package/dist/templates/react-app/src/pages/auth/RegisterPage.tsx +0 -226
- package/dist/templates/react-app/src/pages/base/AboutPage.tsx +0 -123
- package/dist/templates/react-app/src/pages/base/ExecutorPage.tsx +0 -467
- package/dist/templates/react-app/src/pages/base/HomePage.tsx +0 -81
- package/dist/templates/react-app/src/pages/base/IdentifierPage.tsx +0 -117
- package/dist/templates/react-app/src/pages/base/JSONStoragePage.tsx +0 -132
- package/dist/templates/react-app/src/pages/base/Layout.tsx +0 -20
- package/dist/templates/react-app/src/pages/base/MessagePage.tsx +0 -71
- package/dist/templates/react-app/src/pages/base/RedirectPathname.tsx +0 -18
- package/dist/templates/react-app/src/pages/base/RequestPage.tsx +0 -193
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/_default.css +0 -280
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/dark.css +0 -233
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/pink.css +0 -246
- package/dist/templates/react-app/src/styles/css/antd-themes/index.css +0 -4
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/_default.css +0 -108
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/dark.css +0 -67
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/pink.css +0 -67
- package/dist/templates/react-app/src/styles/css/antd-themes/no-context.css +0 -34
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/_default.css +0 -34
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/dark.css +0 -31
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/pink.css +0 -36
- package/dist/templates/react-app/src/styles/css/antd-themes/table/_default.css +0 -44
- package/dist/templates/react-app/src/styles/css/antd-themes/table/dark.css +0 -43
- package/dist/templates/react-app/src/styles/css/antd-themes/table/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/table/pink.css +0 -43
- package/dist/templates/react-app/src/styles/css/index.css +0 -6
- package/dist/templates/react-app/src/styles/css/page.css +0 -20
- package/dist/templates/react-app/src/styles/css/scrollbar.css +0 -34
- package/dist/templates/react-app/src/styles/css/tailwind.css +0 -5
- package/dist/templates/react-app/src/styles/css/themes/_default.css +0 -30
- package/dist/templates/react-app/src/styles/css/themes/dark.css +0 -30
- package/dist/templates/react-app/src/styles/css/themes/index.css +0 -3
- package/dist/templates/react-app/src/styles/css/themes/pink.css +0 -30
- package/dist/templates/react-app/src/styles/css/zIndex.css +0 -9
- package/dist/templates/react-app/src/uikit/bridges/ExecutorPageBridge.ts +0 -72
- package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +0 -41
- package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +0 -22
- package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +0 -136
- package/dist/templates/react-app/src/uikit/components/AppRouterProvider.tsx +0 -35
- package/dist/templates/react-app/src/uikit/components/BaseHeader.tsx +0 -51
- package/dist/templates/react-app/src/uikit/components/BaseLayoutProvider.tsx +0 -44
- package/dist/templates/react-app/src/uikit/components/BaseRouteProvider.tsx +0 -21
- package/dist/templates/react-app/src/uikit/components/BaseRouteSeo.tsx +0 -18
- package/dist/templates/react-app/src/uikit/components/BootstrapsProvider.tsx +0 -11
- package/dist/templates/react-app/src/uikit/components/ClientSeo.tsx +0 -62
- package/dist/templates/react-app/src/uikit/components/ComboProvider.tsx +0 -38
- package/dist/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +0 -78
- package/dist/templates/react-app/src/uikit/components/Loading.tsx +0 -49
- package/dist/templates/react-app/src/uikit/components/LocaleLink.tsx +0 -43
- package/dist/templates/react-app/src/uikit/components/LogoutButton.tsx +0 -58
- package/dist/templates/react-app/src/uikit/components/MessageBaseList.tsx +0 -258
- package/dist/templates/react-app/src/uikit/components/RouterRenderComponent.tsx +0 -19
- package/dist/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +0 -137
- package/dist/templates/react-app/src/uikit/components/With.tsx +0 -17
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatMessageBridge.ts +0 -205
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatRoot.tsx +0 -21
- package/dist/templates/react-app/src/uikit/components/chatMessage/FocusBar.tsx +0 -108
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageApi.ts +0 -282
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageItem.tsx +0 -102
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessagesList.tsx +0 -86
- package/dist/templates/react-app/src/uikit/contexts/BaseRouteContext.ts +0 -42
- package/dist/templates/react-app/src/uikit/contexts/IOCContext.ts +0 -13
- package/dist/templates/react-app/src/uikit/hooks/useAppTranslation.ts +0 -26
- package/dist/templates/react-app/src/uikit/hooks/useI18nInterface.ts +0 -25
- package/dist/templates/react-app/src/uikit/hooks/useIOC.ts +0 -35
- package/dist/templates/react-app/src/uikit/hooks/useNavigateBridge.ts +0 -21
- package/dist/templates/react-app/src/uikit/hooks/useRouterI18nGuard.ts +0 -25
- package/dist/templates/react-app/src/uikit/hooks/useStrictEffect.ts +0 -31
- package/dist/templates/react-app/src/vite-env.d.ts +0 -1
- package/dist/templates/react-app/tailwind.config.js +0 -4
- package/dist/templates/react-app/tsconfig.app.json +0 -36
- package/dist/templates/react-app/tsconfig.e2e.json +0 -24
- package/dist/templates/react-app/tsconfig.json +0 -22
- package/dist/templates/react-app/tsconfig.node.json +0 -27
- package/dist/templates/react-app/tsconfig.test.json +0 -18
- package/dist/templates/react-app/vite.config.ts +0 -144
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { inject, injectable } from 'inversify';
|
|
2
|
-
import type { useRouter } from '@/i18n/routing';
|
|
3
|
-
import { I } from '@config/IOCIdentifier';
|
|
4
|
-
import type { UIBridgeInterface } from '@qlover/corekit-bridge';
|
|
5
|
-
import type { LoggerInterface } from '@qlover/logger';
|
|
6
|
-
|
|
7
|
-
type AppRouterInstance = ReturnType<typeof useRouter>;
|
|
8
|
-
|
|
9
|
-
@injectable()
|
|
10
|
-
export class NavigateBridge implements UIBridgeInterface<AppRouterInstance> {
|
|
11
|
-
protected navigate: AppRouterInstance | null = null;
|
|
12
|
-
|
|
13
|
-
constructor(@inject(I.Logger) protected logger: LoggerInterface) {}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @override
|
|
17
|
-
*/
|
|
18
|
-
public setUIBridge(ui: AppRouterInstance): void {
|
|
19
|
-
this.navigate = ui;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @override
|
|
24
|
-
*/
|
|
25
|
-
public getUIBridge(): AppRouterInstance | null {
|
|
26
|
-
if (!this.navigate) {
|
|
27
|
-
this.logger.debug('NavigateBridge this.navigate is not set');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return this.navigate;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { clone, isObject } from 'lodash';
|
|
2
|
-
import type {
|
|
3
|
-
ExecutorContextInterface,
|
|
4
|
-
LifecyclePluginInterface,
|
|
5
|
-
RequestAdapterConfig,
|
|
6
|
-
EncryptorInterface
|
|
7
|
-
} from '@qlover/fe-corekit';
|
|
8
|
-
|
|
9
|
-
export interface RequestEncryptPluginProps<
|
|
10
|
-
Request = unknown
|
|
11
|
-
> extends RequestAdapterConfig<Request> {
|
|
12
|
-
/**
|
|
13
|
-
* 加密密码在 HTTP 请求中
|
|
14
|
-
*
|
|
15
|
-
* - 如果为空,则不加密密码
|
|
16
|
-
* - 如果为字符串,则加密密码
|
|
17
|
-
* - 如果为数组,则加密密码
|
|
18
|
-
*/
|
|
19
|
-
encryptProps?: string[] | string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class RequestEncryptPlugin implements LifecyclePluginInterface<
|
|
23
|
-
ExecutorContextInterface<RequestEncryptPluginProps>
|
|
24
|
-
> {
|
|
25
|
-
public readonly pluginName = 'RequestEncryptPlugin';
|
|
26
|
-
|
|
27
|
-
constructor(protected encryptor: EncryptorInterface<string, string>) {}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @override
|
|
31
|
-
*/
|
|
32
|
-
public onBefore(
|
|
33
|
-
context: ExecutorContextInterface<RequestEncryptPluginProps>
|
|
34
|
-
): void | Promise<void> {
|
|
35
|
-
const { responseType, encryptProps } = context.parameters;
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
responseType === 'json' &&
|
|
39
|
-
isObject(context.parameters.data) &&
|
|
40
|
-
encryptProps
|
|
41
|
-
) {
|
|
42
|
-
context.setParameters({
|
|
43
|
-
...context.parameters,
|
|
44
|
-
data: {
|
|
45
|
-
...context.parameters.data,
|
|
46
|
-
...this.encryptData(clone(context.parameters.data), encryptProps)
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
protected encryptData<T extends object>(
|
|
53
|
-
data: T,
|
|
54
|
-
encryptProps?: string | string[]
|
|
55
|
-
): T {
|
|
56
|
-
if (typeof encryptProps === 'string') {
|
|
57
|
-
const targetValue = data[encryptProps as keyof T];
|
|
58
|
-
|
|
59
|
-
if (typeof targetValue === 'string') {
|
|
60
|
-
const newValue = this.encryptor.encrypt(targetValue);
|
|
61
|
-
Object.assign(data, { [encryptProps]: newValue });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (Array.isArray(encryptProps)) {
|
|
66
|
-
encryptProps.forEach((prop) => {
|
|
67
|
-
const targetValue = data[prop as keyof T];
|
|
68
|
-
if (typeof targetValue === 'string') {
|
|
69
|
-
const newValue = this.encryptor.encrypt(targetValue);
|
|
70
|
-
Object.assign(data, { [prop]: newValue });
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { RequestState } from '@qlover/corekit-bridge';
|
|
2
|
-
import type { PaginationInterface } from '@/server/port/PaginationInterface';
|
|
3
|
-
import type {
|
|
4
|
-
ResourceQuery,
|
|
5
|
-
ResourceStateInterface
|
|
6
|
-
} from '@qlover/corekit-bridge';
|
|
7
|
-
|
|
8
|
-
export class ResourceState implements ResourceStateInterface {
|
|
9
|
-
public searchParams: ResourceQuery = {
|
|
10
|
-
page: 1,
|
|
11
|
-
pageSize: 10,
|
|
12
|
-
orderBy: 'updated_at',
|
|
13
|
-
order: 1
|
|
14
|
-
};
|
|
15
|
-
public initState = new RequestState<unknown>();
|
|
16
|
-
public listState = new RequestState<PaginationInterface<unknown>>();
|
|
17
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { inject, injectable } from 'inversify';
|
|
2
|
-
import { ROUTE_LOGIN } from '@config/route';
|
|
3
|
-
import { NavigateBridge } from './NavigateBridge';
|
|
4
|
-
import type { RouterInterface, RouterPathname } from '../port/RouterInterface';
|
|
5
|
-
import type { UIBridgeInterface } from '@qlover/corekit-bridge';
|
|
6
|
-
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
|
|
7
|
-
|
|
8
|
-
@injectable()
|
|
9
|
-
export class RouterService implements RouterInterface {
|
|
10
|
-
protected locale: string = '';
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
@inject(NavigateBridge)
|
|
14
|
-
protected uiBridge: UIBridgeInterface<AppRouterInstance>
|
|
15
|
-
) {}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @override
|
|
19
|
-
*/
|
|
20
|
-
public goto(href: RouterPathname): void {
|
|
21
|
-
this.uiBridge.getUIBridge()?.push(href as string);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @override
|
|
26
|
-
*/
|
|
27
|
-
public gotoHome(): void {
|
|
28
|
-
this.goto('/');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public gotoLogin(): void {
|
|
32
|
-
this.goto(ROUTE_LOGIN);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public replaceHome(): void {
|
|
36
|
-
this.uiBridge.getUIBridge()?.replace('/');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @override
|
|
41
|
-
*/
|
|
42
|
-
public setLocale(locale: string): void {
|
|
43
|
-
this.locale = locale;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @override
|
|
48
|
-
*/
|
|
49
|
-
public getLocale(): string {
|
|
50
|
-
return this.locale;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Base64Serializer, type EncryptorInterface } from '@qlover/fe-corekit';
|
|
2
|
-
import { inject, injectable } from 'inversify';
|
|
3
|
-
import { I } from '@config/IOCIdentifier';
|
|
4
|
-
import type { AppConfig } from './AppConfig';
|
|
5
|
-
|
|
6
|
-
@injectable()
|
|
7
|
-
export class StringEncryptor implements EncryptorInterface<string, string> {
|
|
8
|
-
private readonly key;
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
@inject(I.AppConfig) appConfig: AppConfig,
|
|
12
|
-
@inject(Base64Serializer) protected base64Serializer: Base64Serializer
|
|
13
|
-
) {
|
|
14
|
-
if (!appConfig.stringEncryptorKey) {
|
|
15
|
-
throw new Error('StringEncryptorKey is not set');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
this.key = appConfig.stringEncryptorKey;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
protected encryptWithKey(str: string, key: string): string {
|
|
22
|
-
const result = [];
|
|
23
|
-
for (let i = 0; i < str.length; i++) {
|
|
24
|
-
// 使用字符的 Unicode 值和密钥进行混合运算
|
|
25
|
-
const charCode = str.charCodeAt(i);
|
|
26
|
-
const keyChar = key.charCodeAt(i % key.length);
|
|
27
|
-
// 使用多个运算来增加复杂度
|
|
28
|
-
const encrypted = (charCode + keyChar * 13) ^ (keyChar + i * 7);
|
|
29
|
-
result.push(String.fromCharCode(encrypted % 65536)); // 确保结果在有效的 Unicode 范围内
|
|
30
|
-
}
|
|
31
|
-
return result.join('');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
protected decryptWithKey(str: string, key: string): string {
|
|
35
|
-
const result = [];
|
|
36
|
-
for (let i = 0; i < str.length; i++) {
|
|
37
|
-
const charCode = str.charCodeAt(i);
|
|
38
|
-
const keyChar = key.charCodeAt(i % key.length);
|
|
39
|
-
// 反向运算还原原始字符
|
|
40
|
-
const decrypted = (charCode ^ (keyChar + i * 7)) - keyChar * 13;
|
|
41
|
-
result.push(String.fromCharCode(decrypted));
|
|
42
|
-
}
|
|
43
|
-
return result.join('');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @override
|
|
48
|
-
*/
|
|
49
|
-
public encrypt(value: string): string {
|
|
50
|
-
try {
|
|
51
|
-
const encrypted = this.encryptWithKey(value, this.key);
|
|
52
|
-
return this.base64Serializer.serialize(encrypted);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error('Encryption failed:', error);
|
|
55
|
-
throw new Error('Encryption failed');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @override
|
|
61
|
-
*/
|
|
62
|
-
public decrypt(encryptedValue: string): string {
|
|
63
|
-
try {
|
|
64
|
-
// 1. 先用 base64 反序列化
|
|
65
|
-
const decoded = this.base64Serializer.deserialize(encryptedValue);
|
|
66
|
-
// 2. 然后用密钥解密
|
|
67
|
-
return this.decryptWithKey(decoded, this.key);
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error('Decryption failed:', error);
|
|
70
|
-
throw new Error('Decryption failed');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { logger } from '@/core/globals';
|
|
2
|
-
import { i18nWarnMissingTranslation } from '@config/common';
|
|
3
|
-
import type { PageI18nInterface } from '@config/i18n';
|
|
4
|
-
import type { Formats, useTranslations } from 'next-intl';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Translate I18n Interface tools class
|
|
8
|
-
*
|
|
9
|
-
* @param i18nInterface - The i18n interface to translate
|
|
10
|
-
* @param t - The translations function
|
|
11
|
-
* @returns The translated i18n interface
|
|
12
|
-
*/
|
|
13
|
-
export class TranslateI18nUtil {
|
|
14
|
-
public static translate<T extends PageI18nInterface | Record<string, string>>(
|
|
15
|
-
source: T,
|
|
16
|
-
t: ReturnType<typeof useTranslations>
|
|
17
|
-
): T {
|
|
18
|
-
return Object.fromEntries(
|
|
19
|
-
Object.entries(source).map(([key, value]) => {
|
|
20
|
-
if (typeof value === 'string') {
|
|
21
|
-
return [key, t(value)];
|
|
22
|
-
}
|
|
23
|
-
return [key, value];
|
|
24
|
-
})
|
|
25
|
-
) as T;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public static overrideTranslateT(
|
|
29
|
-
t: ReturnType<typeof useTranslations>
|
|
30
|
-
): ReturnType<typeof useTranslations> {
|
|
31
|
-
return function ot(
|
|
32
|
-
key: string,
|
|
33
|
-
values?: Record<string, string | number | Date> | undefined,
|
|
34
|
-
formats?: Formats | undefined
|
|
35
|
-
) {
|
|
36
|
-
try {
|
|
37
|
-
if (!i18nWarnMissingTranslation) {
|
|
38
|
-
return t(key, values, formats);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (t.has(key)) {
|
|
42
|
-
return t(key, values, formats);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
logger.warn(`[i18n] Missing translation: ${key}`);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
logger.error(`[i18n] Error translation: ${key}`, String(e));
|
|
48
|
-
return t.raw(key);
|
|
49
|
-
}
|
|
50
|
-
return key;
|
|
51
|
-
} as ReturnType<typeof useTranslations>;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { ResourceTableFormMap } from '@brain-toolkit/antd-blocks';
|
|
2
|
-
import { merge } from 'lodash';
|
|
3
|
-
import {
|
|
4
|
-
type z,
|
|
5
|
-
ZodFirstPartyTypeKind,
|
|
6
|
-
type ZodObject,
|
|
7
|
-
type ZodRawShape,
|
|
8
|
-
type ZodType
|
|
9
|
-
} from 'zod';
|
|
10
|
-
import { joinI18nKey } from '@config/i18n/i18nKeyScheam';
|
|
11
|
-
import type { ZodBuilderInterface } from '../port/ZodBuilderInterface';
|
|
12
|
-
import type {
|
|
13
|
-
ResourceTableFormType,
|
|
14
|
-
ResourceTableOption
|
|
15
|
-
} from '@brain-toolkit/antd-blocks';
|
|
16
|
-
import type { NamePath } from 'antd/es/form/interface';
|
|
17
|
-
import type { useTranslations } from 'next-intl';
|
|
18
|
-
|
|
19
|
-
type OptionMap<
|
|
20
|
-
Value extends ZodRawShape,
|
|
21
|
-
Input extends ZodObject<Value>
|
|
22
|
-
> = Record<keyof Input['shape'], ResourceTableOption<z.infer<Input>>>;
|
|
23
|
-
|
|
24
|
-
export const ZodType2RenderFormMap = {
|
|
25
|
-
[ZodFirstPartyTypeKind.ZodString]: ResourceTableFormMap.input,
|
|
26
|
-
[ZodFirstPartyTypeKind.ZodNumber]: ResourceTableFormMap.input,
|
|
27
|
-
[ZodFirstPartyTypeKind.ZodBigInt]: ResourceTableFormMap.input,
|
|
28
|
-
[ZodFirstPartyTypeKind.ZodBoolean]: ResourceTableFormMap.select,
|
|
29
|
-
[ZodFirstPartyTypeKind.ZodEnum]: ResourceTableFormMap.select,
|
|
30
|
-
[ZodFirstPartyTypeKind.ZodNativeEnum]: ResourceTableFormMap.select
|
|
31
|
-
} as const;
|
|
32
|
-
|
|
33
|
-
export class ZodColumnBuilder<
|
|
34
|
-
Value extends ZodRawShape,
|
|
35
|
-
Input extends ZodObject<Value>
|
|
36
|
-
> implements ZodBuilderInterface<Input, ResourceTableOption<z.infer<Input>>> {
|
|
37
|
-
protected optionMap: OptionMap<Value, Input>;
|
|
38
|
-
|
|
39
|
-
constructor(
|
|
40
|
-
readonly namespace: string,
|
|
41
|
-
readonly input: Input,
|
|
42
|
-
optionMap?: OptionMap<Value, Input>
|
|
43
|
-
) {
|
|
44
|
-
const baseOptions = this.getBaseOptions(input);
|
|
45
|
-
this.optionMap = optionMap ? merge(baseOptions, optionMap) : baseOptions;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @override
|
|
50
|
-
*/
|
|
51
|
-
public static zodType2RenderForm(
|
|
52
|
-
zod: ZodType
|
|
53
|
-
): ResourceTableFormType | undefined {
|
|
54
|
-
// @ts-expect-error - zod._def.typeName is not typed
|
|
55
|
-
const typeName = zod._def?.typeName as ZodFirstPartyTypeKind;
|
|
56
|
-
|
|
57
|
-
// Handle wrapper types (Optional, Nullable, Default)
|
|
58
|
-
if (
|
|
59
|
-
typeName === ZodFirstPartyTypeKind.ZodOptional ||
|
|
60
|
-
typeName === ZodFirstPartyTypeKind.ZodNullable ||
|
|
61
|
-
typeName === ZodFirstPartyTypeKind.ZodDefault
|
|
62
|
-
) {
|
|
63
|
-
// @ts-expect-error - innerType is not typed
|
|
64
|
-
return ZodColumnBuilder.zodType2RenderForm(zod._def.innerType);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Direct mapping lookup
|
|
68
|
-
return ZodType2RenderFormMap[
|
|
69
|
-
typeName as keyof typeof ZodType2RenderFormMap
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public zod2BaseOption(
|
|
74
|
-
key: string,
|
|
75
|
-
zod: ZodType
|
|
76
|
-
): ResourceTableOption<z.infer<Input>> {
|
|
77
|
-
return {
|
|
78
|
-
key: key,
|
|
79
|
-
title: key,
|
|
80
|
-
dataIndex: key,
|
|
81
|
-
tt: {
|
|
82
|
-
tableTitle: joinI18nKey(this.namespace, key, 'title'),
|
|
83
|
-
description: joinI18nKey(this.namespace, key, 'description'),
|
|
84
|
-
formItemLabel: joinI18nKey(this.namespace, key, 'label'),
|
|
85
|
-
formItemPlaceholder: joinI18nKey(this.namespace, key, 'placeholder'),
|
|
86
|
-
formItemError: joinI18nKey(this.namespace, key, 'error'),
|
|
87
|
-
formItemRequired: joinI18nKey(this.namespace, key, 'required')
|
|
88
|
-
},
|
|
89
|
-
renderForm: ZodColumnBuilder.zodType2RenderForm(zod),
|
|
90
|
-
formItemWrapProps: {
|
|
91
|
-
name: key as NamePath<z.infer<Input>>,
|
|
92
|
-
label: key,
|
|
93
|
-
rules: []
|
|
94
|
-
},
|
|
95
|
-
formItemProps: {}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public getBaseOptions(input: Input): OptionMap<Value, Input> {
|
|
100
|
-
return Object.entries(input.shape).reduce(
|
|
101
|
-
(acc, [key, zod]) => {
|
|
102
|
-
acc[key as keyof Input['shape']] = this.zod2BaseOption(
|
|
103
|
-
key,
|
|
104
|
-
zod as ZodType
|
|
105
|
-
);
|
|
106
|
-
return acc;
|
|
107
|
-
},
|
|
108
|
-
{} as OptionMap<Value, Input>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @override
|
|
114
|
-
*/
|
|
115
|
-
public bind(
|
|
116
|
-
key: keyof Input['shape'],
|
|
117
|
-
params?: Partial<ResourceTableOption<z.infer<Input>>>
|
|
118
|
-
): this {
|
|
119
|
-
if (params) {
|
|
120
|
-
const existingOption = this.optionMap[key];
|
|
121
|
-
this.optionMap[key] = merge({}, existingOption, params);
|
|
122
|
-
}
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public render<K extends keyof Input['shape']>(
|
|
127
|
-
key: K,
|
|
128
|
-
render: (
|
|
129
|
-
value: unknown,
|
|
130
|
-
record: z.infer<Input>,
|
|
131
|
-
index: number
|
|
132
|
-
) => React.ReactNode
|
|
133
|
-
): this {
|
|
134
|
-
this.optionMap[key].render = render;
|
|
135
|
-
return this;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Translate all i18n keys in options to actual text
|
|
140
|
-
* @param t - Translation function from next-intl
|
|
141
|
-
* @returns this for chaining
|
|
142
|
-
*/
|
|
143
|
-
public translate(t: ReturnType<typeof useTranslations>): this {
|
|
144
|
-
Object.values(this.optionMap).forEach((option) => {
|
|
145
|
-
const { tt } = option;
|
|
146
|
-
// Translate title if it's a string (i18n key)
|
|
147
|
-
if (typeof option.title === 'string') {
|
|
148
|
-
option.title = t(tt.tableTitle);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Translate formItemWrapProps label if exists
|
|
152
|
-
if (
|
|
153
|
-
option.formItemWrapProps?.label &&
|
|
154
|
-
typeof option.formItemWrapProps.label === 'string'
|
|
155
|
-
) {
|
|
156
|
-
option.formItemWrapProps = {
|
|
157
|
-
...option.formItemWrapProps,
|
|
158
|
-
label: t(tt.formItemLabel)
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Translate formItemProps placeholder if exists
|
|
163
|
-
if (option.formItemProps && typeof option.formItemProps === 'object') {
|
|
164
|
-
Object.assign(
|
|
165
|
-
option.formItemProps as Record<string, unknown>,
|
|
166
|
-
{
|
|
167
|
-
placeholder: t(tt.formItemPlaceholder)
|
|
168
|
-
} as Record<string, unknown>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
return this;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Build a single option by key
|
|
178
|
-
* @override
|
|
179
|
-
* @param key - The key of the option to build
|
|
180
|
-
* @param params - Optional additional parameters to merge
|
|
181
|
-
* @returns The built option
|
|
182
|
-
*/
|
|
183
|
-
public build(
|
|
184
|
-
key: string,
|
|
185
|
-
params?: unknown
|
|
186
|
-
): ResourceTableOption<z.infer<Input>> {
|
|
187
|
-
const option = this.optionMap[key as keyof Input['shape']];
|
|
188
|
-
if (!option) {
|
|
189
|
-
throw new Error(`Option with key "${key}" not found`);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (params && typeof params === 'object') {
|
|
193
|
-
return merge(
|
|
194
|
-
{},
|
|
195
|
-
option,
|
|
196
|
-
params as Partial<ResourceTableOption<z.infer<Input>>>
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return option;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Build all options
|
|
205
|
-
* @override
|
|
206
|
-
* @param params - Optional additional parameters (currently unused)
|
|
207
|
-
* @returns Array of all built options
|
|
208
|
-
*/
|
|
209
|
-
public buildAll(_params?: unknown): ResourceTableOption<z.infer<Input>>[] {
|
|
210
|
-
return Object.values(this.optionMap);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { StoreInterface } from '@qlover/corekit-bridge';
|
|
2
|
-
import type { StoreStateInterface } from '@qlover/corekit-bridge';
|
|
3
|
-
|
|
4
|
-
export interface NavItemInterface {
|
|
5
|
-
key: string;
|
|
6
|
-
/**
|
|
7
|
-
* 可以是 i18n key
|
|
8
|
-
*/
|
|
9
|
-
i18nKey: string;
|
|
10
|
-
|
|
11
|
-
pathname?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface AdminPageState extends StoreStateInterface {
|
|
15
|
-
navItems: NavItemInterface[];
|
|
16
|
-
collapsedSidebar: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export abstract class AdminLayoutInterface extends StoreInterface<AdminPageState> {
|
|
20
|
-
public readonly selectors = {
|
|
21
|
-
collapsedSidebar: (state: AdminPageState) => state.collapsedSidebar,
|
|
22
|
-
navItems: (state: AdminPageState) => state.navItems
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
public abstract toggleSidebar(): void;
|
|
26
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export interface AppApiErrorInterface {
|
|
2
|
-
success: false;
|
|
3
|
-
id: string;
|
|
4
|
-
message?: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface AppApiSuccessInterface<T = unknown> {
|
|
8
|
-
success: true;
|
|
9
|
-
data?: T;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type AppApiResult<T = unknown> =
|
|
13
|
-
| AppApiErrorInterface
|
|
14
|
-
| AppApiSuccessInterface<T>;
|
|
15
|
-
|
|
16
|
-
export function isAppApiSuccessInterface(
|
|
17
|
-
result: unknown
|
|
18
|
-
): result is AppApiSuccessInterface {
|
|
19
|
-
return (
|
|
20
|
-
typeof result === 'object' &&
|
|
21
|
-
result !== null &&
|
|
22
|
-
'success' in result &&
|
|
23
|
-
result.success === true
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function isAppApiErrorInterface(
|
|
28
|
-
result: unknown
|
|
29
|
-
): result is AppApiErrorInterface {
|
|
30
|
-
return (
|
|
31
|
-
typeof result === 'object' &&
|
|
32
|
-
result !== null &&
|
|
33
|
-
'success' in result &&
|
|
34
|
-
result.success === false
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { LoginValidatorData } from '@/server/validators/LoginValidator';
|
|
2
|
-
import type { UserSchema } from '@migrations/schema/UserSchema';
|
|
3
|
-
import type { AppApiTransaction } from '../services/AppApiRequester';
|
|
4
|
-
|
|
5
|
-
export type UserApiLoginTransaction = AppApiTransaction<
|
|
6
|
-
LoginValidatorData,
|
|
7
|
-
UserSchema
|
|
8
|
-
>;
|
|
9
|
-
|
|
10
|
-
export type UserApiRegisterTransaction = AppApiTransaction<
|
|
11
|
-
LoginValidatorData,
|
|
12
|
-
UserSchema
|
|
13
|
-
>;
|
|
14
|
-
|
|
15
|
-
export type UserApiLogoutTransaction = AppApiTransaction<unknown, void>;
|
|
16
|
-
|
|
17
|
-
export interface AppUserApiInterface {
|
|
18
|
-
login(
|
|
19
|
-
params: UserApiLoginTransaction['data']
|
|
20
|
-
): Promise<UserApiLoginTransaction['response']>;
|
|
21
|
-
|
|
22
|
-
register(
|
|
23
|
-
params: UserApiRegisterTransaction['data']
|
|
24
|
-
): Promise<UserApiRegisterTransaction['response']>;
|
|
25
|
-
|
|
26
|
-
logout(params?: unknown): Promise<UserApiLogoutTransaction['response']>;
|
|
27
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
StoreInterface,
|
|
3
|
-
type StoreStateInterface
|
|
4
|
-
} from '@qlover/corekit-bridge';
|
|
5
|
-
import type { Locale } from '@/i18n/routing';
|
|
6
|
-
import type { i18nConfig } from '@config/i18n';
|
|
7
|
-
|
|
8
|
-
export type SupportedLocale = (typeof i18nConfig.supportedLngs)[number];
|
|
9
|
-
export type SupportedNamespace = typeof i18nConfig.fallbackLng;
|
|
10
|
-
export type I18nServiceLocale = Locale;
|
|
11
|
-
|
|
12
|
-
export class I18nServiceState implements StoreStateInterface {
|
|
13
|
-
public loading: boolean = false;
|
|
14
|
-
constructor(public language: I18nServiceLocale) {}
|
|
15
|
-
}
|
|
16
|
-
export abstract class I18nServiceInterface extends StoreInterface<I18nServiceState> {
|
|
17
|
-
public abstract t(key: string, params?: Record<string, unknown>): string;
|
|
18
|
-
public abstract changeLanguage(language: I18nServiceLocale): Promise<void>;
|
|
19
|
-
public abstract changeLoading(loading: boolean): void;
|
|
20
|
-
public abstract getCurrentLanguage(): Promise<I18nServiceLocale>;
|
|
21
|
-
public abstract isValidLanguage(
|
|
22
|
-
language: string
|
|
23
|
-
): language is I18nServiceLocale;
|
|
24
|
-
public abstract getSupportedLanguages(): I18nServiceLocale[];
|
|
25
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
EnvConfigInterface,
|
|
3
|
-
IOCContainerInterface,
|
|
4
|
-
IOCFunctionInterface
|
|
5
|
-
} from '@qlover/corekit-bridge';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* IOC register options
|
|
9
|
-
*/
|
|
10
|
-
export type IocRegisterOptions = {
|
|
11
|
-
/**
|
|
12
|
-
* The app config
|
|
13
|
-
*/
|
|
14
|
-
appConfig: EnvConfigInterface;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export interface IOCInterface<
|
|
18
|
-
IdentifierMap,
|
|
19
|
-
IOCContainer extends IOCContainerInterface
|
|
20
|
-
> {
|
|
21
|
-
create(
|
|
22
|
-
options: IocRegisterOptions
|
|
23
|
-
): IOCFunctionInterface<IdentifierMap, IOCContainer>;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 该方法主要用于在应用启动前注册所有依赖
|
|
27
|
-
*
|
|
28
|
-
* 因为ssr渲染的原因可能需要在一些特定的环境下注册一些依赖
|
|
29
|
-
*
|
|
30
|
-
* @param options - 注册选项
|
|
31
|
-
*/
|
|
32
|
-
register(options?: IocRegisterOptions): void;
|
|
33
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { redirect } from '@/i18n/routing';
|
|
2
|
-
export type RouterPathname = Parameters<typeof redirect>[0]['href'];
|
|
3
|
-
|
|
4
|
-
export interface RouterInterface {
|
|
5
|
-
gotoHome(): void;
|
|
6
|
-
goto(href: RouterPathname): void;
|
|
7
|
-
|
|
8
|
-
getLocale(): string;
|
|
9
|
-
|
|
10
|
-
setLocale(locale: string): void;
|
|
11
|
-
}
|