create-nexwire 4.2.5 → 4.4.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/README.md +29 -12
- package/express/.env +1 -1
- package/express/package.json +1 -1
- package/express/src/config/database.ts +48 -29
- package/express/src/config/index.ts +83 -83
- package/express/src/config/openapi.ts +6 -24
- package/express/src/config/queue.ts +30 -30
- package/express/src/config/validate.ts +50 -40
- package/express/src/database/migrations/sqlite/0000_init.sql +47 -47
- package/express/src/database/migrations/sqlite/meta/0000_snapshot.json +1 -1
- package/express/src/database/migrations/sqlite/meta/_journal.json +1 -1
- package/express/src/framework/cache/cache.ts +40 -8
- package/express/src/framework/circuit-breaker/cb.ts +88 -60
- package/express/src/framework/database/connection.ts +52 -27
- package/express/src/framework/events/dispatcher.ts +61 -49
- package/express/src/framework/facade.ts +47 -3
- package/express/src/framework/http/app.ts +28 -22
- package/express/src/framework/http/logger.ts +37 -17
- package/express/src/framework/http/openapi.ts +9 -11
- package/express/src/framework/maker-cli/runtime/core.mjs +1 -2
- package/express/src/framework/modules/routes.ts +26 -21
- package/express/src/framework/notification/channels/broadcast.ts +15 -0
- package/express/src/framework/notification/channels/mail.ts +42 -0
- package/express/src/framework/notification/contracts.ts +29 -0
- package/express/src/framework/notification/index.ts +19 -94
- package/express/src/framework/notification/registry.ts +15 -0
- package/express/src/framework/providers/adapter.ts +27 -17
- package/express/src/framework/queue/queue.ts +43 -44
- package/express/src/framework/realtime/broadcast.ts +29 -5
- package/express/src/framework/realtime/socket.ts +149 -119
- package/express/src/framework/redis/client.ts +148 -151
- package/express/src/framework/runtime/server-adapter.ts +39 -34
- package/express/src/framework/scheduler/lock.ts +128 -116
- package/express/src/framework/server.ts +33 -49
- package/express/src/framework/session/session.ts +69 -14
- package/express/src/framework/storage/storage.ts +744 -785
- package/express/src/framework/support/mail.ts +15 -7
- package/express/src/middlewares/auth-middleware.ts +1 -2
- package/express/src/middlewares/role-middleware.ts +3 -13
- package/express/src/modules/auth/routes/index.ts +1 -2
- package/express/src/providers/notification.ts +4 -0
- package/express/src/resources/src/components/Switch.vue +60 -65
- package/express/src/resources/src/layouts/Layout/Header.vue +124 -105
- package/express/src/resources/src/pages/auth/forgetPassword.vue +23 -30
- package/express/src/resources/src/pages/auth/login.vue +25 -28
- package/express/src/resources/src/pages/auth/register.vue +35 -39
- package/express/src/resources/src/pages/auth/resetPassword.vue +29 -37
- package/express/src/resources/src/pages/auth/verifyEmail.vue +15 -19
- package/express/src/resources/src/plugins/gum.ts +519 -203
- package/express/src/resources/src/plugins/pulse.ts +157 -147
- package/express/src/resources/src/stores/auth.ts +9 -6
- package/express/src/resources/vite.config.ts +54 -43
- package/express/src/storage/database/nexwire.sqlite +0 -0
- package/express/src/storage/logs/app.log +0 -0
- package/express/src/storage/logs/fatal.log +0 -0
- package/express/src/types/global.d.ts +32 -26
- package/fastify/.dockerignore +14 -0
- package/fastify/.env +44 -0
- package/fastify/.env.example +42 -0
- package/fastify/.vscode/extensions.json +6 -0
- package/fastify/.vscode/settings.json +37 -0
- package/fastify/LICENSE +21 -0
- package/fastify/README.md +232 -0
- package/fastify/biome.json +99 -0
- package/fastify/drizzle.config.ts +25 -0
- package/fastify/gitignore-stub +31 -0
- package/fastify/package.json +130 -0
- package/fastify/public/.gitkeep +0 -0
- package/fastify/src/config/app.ts +41 -0
- package/fastify/src/config/auth.ts +12 -0
- package/fastify/src/config/cache.ts +16 -0
- package/fastify/src/config/cookie.ts +15 -0
- package/fastify/src/config/cors.ts +12 -0
- package/fastify/src/config/database.ts +48 -0
- package/fastify/src/config/index.ts +83 -0
- package/fastify/src/config/jwt.ts +19 -0
- package/fastify/src/config/logging.ts +13 -0
- package/fastify/src/config/mail.ts +24 -0
- package/fastify/src/config/openapi.ts +36 -0
- package/fastify/src/config/queue.ts +30 -0
- package/fastify/src/config/rateLimit.ts +17 -0
- package/fastify/src/config/realtime.ts +15 -0
- package/fastify/src/config/redis.ts +18 -0
- package/fastify/src/config/security.ts +44 -0
- package/fastify/src/config/session.ts +17 -0
- package/fastify/src/config/storage.ts +22 -0
- package/fastify/src/config/validate.ts +50 -0
- package/fastify/src/database/migrations/sqlite/0000_init.sql +48 -0
- package/fastify/src/database/migrations/sqlite/meta/0000_snapshot.json +324 -0
- package/fastify/src/database/migrations/sqlite/meta/_journal.json +13 -0
- package/fastify/src/database/schema.ts +2 -0
- package/fastify/src/env.ts +76 -0
- package/fastify/src/framework/cache/cache.ts +114 -0
- package/fastify/src/framework/circuit-breaker/cb.ts +88 -0
- package/fastify/src/framework/database/app-schema.ts +37 -0
- package/fastify/src/framework/database/connection.ts +223 -0
- package/fastify/src/framework/database/migrate-hooks.ts +87 -0
- package/fastify/src/framework/database/paginate.ts +226 -0
- package/fastify/src/framework/database/schema.ts +20 -0
- package/fastify/src/framework/database/seed.ts +152 -0
- package/fastify/src/framework/events/dispatcher.ts +61 -0
- package/fastify/src/framework/facade.ts +96 -0
- package/fastify/src/framework/http/app.ts +176 -0
- package/fastify/src/framework/http/cors.ts +13 -0
- package/fastify/src/framework/http/fastify.d.ts +13 -0
- package/fastify/src/framework/http/logger.ts +110 -0
- package/fastify/src/framework/http/metrics.ts +22 -0
- package/fastify/src/framework/http/openapi.ts +48 -0
- package/fastify/src/framework/http/ratelimiter.ts +47 -0
- package/fastify/src/framework/http/security.ts +25 -0
- package/fastify/src/framework/http/static.ts +83 -0
- package/fastify/src/framework/http/validation.ts +49 -0
- package/fastify/src/framework/kernel.ts +43 -0
- package/fastify/src/framework/maker-cli/db/core.mjs +291 -0
- package/fastify/src/framework/maker-cli/db/index.mjs +204 -0
- package/fastify/src/framework/maker-cli/deploy/core.mjs +1046 -0
- package/fastify/src/framework/maker-cli/deploy/index.mjs +91 -0
- package/fastify/src/framework/maker-cli/index.mjs +65 -0
- package/fastify/src/framework/maker-cli/middleware/core.mjs +41 -0
- package/fastify/src/framework/maker-cli/middleware/index.mjs +17 -0
- package/fastify/src/framework/maker-cli/module/core.mjs +1066 -0
- package/fastify/src/framework/maker-cli/module/index.mjs +211 -0
- package/fastify/src/framework/maker-cli/provider/core.mjs +49 -0
- package/fastify/src/framework/maker-cli/provider/index.mjs +12 -0
- package/fastify/src/framework/maker-cli/runtime/build-ui.mjs +16 -0
- package/fastify/src/framework/maker-cli/runtime/core.mjs +560 -0
- package/fastify/src/framework/maker-cli/runtime/index.mjs +120 -0
- package/fastify/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
- package/fastify/src/framework/maker-cli/stubs/controller/openapi.ts.stub +74 -0
- package/fastify/src/framework/maker-cli/stubs/controller/plain.ts.stub +77 -0
- package/fastify/src/framework/maker-cli/stubs/controller/standalone.ts.stub +51 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
- package/fastify/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
- package/fastify/src/framework/maker-cli/stubs/facade/name.ts.stub +12 -0
- package/fastify/src/framework/maker-cli/stubs/helper/name.ts.stub +14 -0
- package/fastify/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
- package/fastify/src/framework/maker-cli/stubs/middleware/name.local.ts.stub +15 -0
- package/fastify/src/framework/maker-cli/stubs/middleware/name.ts.stub +15 -0
- package/fastify/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +10 -0
- package/fastify/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +10 -0
- package/fastify/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +10 -0
- package/fastify/src/framework/maker-cli/stubs/notification/controller.ts.stub +79 -0
- package/fastify/src/framework/maker-cli/stubs/notification/job.ts.stub +11 -0
- package/fastify/src/framework/maker-cli/stubs/notification/model.ts.stub +29 -0
- package/fastify/src/framework/maker-cli/stubs/notification/provider.ts.stub +174 -0
- package/fastify/src/framework/maker-cli/stubs/notification/route.api.ts.stub +71 -0
- package/fastify/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +15 -0
- package/fastify/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
- package/fastify/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
- package/fastify/src/framework/maker-cli/stubs/provider/module-barrel.ts.stub +19 -0
- package/fastify/src/framework/maker-cli/stubs/provider/module.ts.stub +21 -0
- package/fastify/src/framework/maker-cli/stubs/provider/name.ts.stub +21 -0
- package/fastify/src/framework/maker-cli/stubs/route/api.ts.stub +101 -0
- package/fastify/src/framework/maker-cli/stubs/route/plain.ts.stub +23 -0
- package/fastify/src/framework/maker-cli/stubs/route/standalone.api.ts.stub +120 -0
- package/fastify/src/framework/maker-cli/stubs/route/standalone.plain.ts.stub +50 -0
- package/fastify/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
- package/fastify/src/framework/maker-cli/stubs/schema/name.plain.ts.stub +14 -0
- package/fastify/src/framework/maker-cli/stubs/schema/name.ts.stub +33 -0
- package/fastify/src/framework/maker-cli/stubs/seeder/name.ts.stub +18 -0
- package/fastify/src/framework/maker-cli/stubs/seeder/standalone.ts.stub +22 -0
- package/fastify/src/framework/maker-cli/stubs/service/name.plain.ts.stub +67 -0
- package/fastify/src/framework/maker-cli/stubs/service/name.ts.stub +65 -0
- package/fastify/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
- package/fastify/src/framework/maker-cli/stubs/type/name.ts.stub +22 -0
- package/fastify/src/framework/maker-cli/utils/env-config.mjs +44 -0
- package/fastify/src/framework/maker-cli/utils/env-db.mjs +61 -0
- package/fastify/src/framework/maker-cli/utils/file-ops.mjs +30 -0
- package/fastify/src/framework/maker-cli/utils/flags.mjs +14 -0
- package/fastify/src/framework/maker-cli/utils/help.mjs +379 -0
- package/fastify/src/framework/maker-cli/utils/naming.mjs +119 -0
- package/fastify/src/framework/maker-cli/utils/process.mjs +52 -0
- package/fastify/src/framework/maker-cli/utils/project-commands.mjs +201 -0
- package/fastify/src/framework/modules/discover.ts +57 -0
- package/fastify/src/framework/modules/routes.ts +31 -0
- package/fastify/src/framework/notification/channels/broadcast.ts +15 -0
- package/fastify/src/framework/notification/channels/mail.ts +42 -0
- package/fastify/src/framework/notification/contracts.ts +29 -0
- package/fastify/src/framework/notification/index.ts +59 -0
- package/fastify/src/framework/notification/registry.ts +15 -0
- package/fastify/src/framework/providers/adapter.ts +149 -0
- package/fastify/src/framework/providers/contracts.ts +126 -0
- package/fastify/src/framework/providers/loader.ts +105 -0
- package/fastify/src/framework/providers/registry.ts +88 -0
- package/fastify/src/framework/queue/clear.ts +22 -0
- package/fastify/src/framework/queue/queue.ts +401 -0
- package/fastify/src/framework/queue/ui.ts +194 -0
- package/fastify/src/framework/queue/worker.ts +61 -0
- package/fastify/src/framework/realtime/broadcast.ts +70 -0
- package/fastify/src/framework/realtime/index.ts +2 -0
- package/fastify/src/framework/realtime/socket-cookie.ts +72 -0
- package/fastify/src/framework/realtime/socket.ts +149 -0
- package/fastify/src/framework/realtime/types.ts +6 -0
- package/fastify/src/framework/realtime/ui.ts +16 -0
- package/fastify/src/framework/redis/client.ts +148 -0
- package/fastify/src/framework/runtime/runtime.ts +23 -0
- package/fastify/src/framework/runtime/server-adapter.ts +33 -0
- package/fastify/src/framework/scheduler/lock.ts +128 -0
- package/fastify/src/framework/scheduler/run.ts +48 -0
- package/fastify/src/framework/scheduler/scheduler.ts +155 -0
- package/fastify/src/framework/server.ts +162 -0
- package/fastify/src/framework/session/session.ts +160 -0
- package/fastify/src/framework/storage/storage.ts +744 -0
- package/fastify/src/framework/support/cookie.ts +71 -0
- package/fastify/src/framework/support/jwt.ts +33 -0
- package/fastify/src/framework/support/lifecycle.ts +35 -0
- package/fastify/src/framework/support/logger.ts +148 -0
- package/fastify/src/framework/support/mail.ts +56 -0
- package/fastify/src/framework/support/password.ts +23 -0
- package/fastify/src/framework/support/status-codes.ts +75 -0
- package/fastify/src/framework/support/upload.ts +181 -0
- package/fastify/src/framework/support/url.ts +41 -0
- package/fastify/src/middlewares/auth-middleware.ts +134 -0
- package/fastify/src/middlewares/role-middleware.ts +19 -0
- package/fastify/src/modules/auth/__tests__/forgetpass.test.ts +200 -0
- package/fastify/src/modules/auth/__tests__/login.test.ts +171 -0
- package/fastify/src/modules/auth/__tests__/logout.test.ts +60 -0
- package/fastify/src/modules/auth/__tests__/logoutalldevices.test.ts +49 -0
- package/fastify/src/modules/auth/__tests__/me.test.ts +91 -0
- package/fastify/src/modules/auth/__tests__/refreshtoken.test.ts +305 -0
- package/fastify/src/modules/auth/__tests__/register.test.ts +291 -0
- package/fastify/src/modules/auth/__tests__/resetpass.test.ts +206 -0
- package/fastify/src/modules/auth/__tests__/verifyemail.test.ts +183 -0
- package/fastify/src/modules/auth/controllers/auth.ts +252 -0
- package/fastify/src/modules/auth/controllers/role.ts +35 -0
- package/fastify/src/modules/auth/database/models/role.ts +14 -0
- package/fastify/src/modules/auth/database/models/user.ts +46 -0
- package/fastify/src/modules/auth/database/seeders/role.ts +18 -0
- package/fastify/src/modules/auth/database/seeders/user.ts +35 -0
- package/fastify/src/modules/auth/facade.ts +12 -0
- package/fastify/src/modules/auth/helpers/auth.ts +115 -0
- package/fastify/src/modules/auth/jobs/forgetpass.ts +20 -0
- package/fastify/src/modules/auth/jobs/registeruser.ts +23 -0
- package/fastify/src/modules/auth/jobs/verifyemail.ts +18 -0
- package/fastify/src/modules/auth/routes/index.ts +185 -0
- package/fastify/src/modules/auth/routes/role.ts +56 -0
- package/fastify/src/modules/auth/schemas/auth.ts +116 -0
- package/fastify/src/modules/auth/services/forgetpassword.ts +66 -0
- package/fastify/src/modules/auth/services/login.ts +63 -0
- package/fastify/src/modules/auth/services/logout.ts +25 -0
- package/fastify/src/modules/auth/services/logoutalldevices.ts +19 -0
- package/fastify/src/modules/auth/services/me.ts +31 -0
- package/fastify/src/modules/auth/services/refreshtoken.ts +110 -0
- package/fastify/src/modules/auth/services/register.ts +141 -0
- package/fastify/src/modules/auth/services/resetpassword.ts +69 -0
- package/fastify/src/modules/auth/services/verifyemail.ts +77 -0
- package/fastify/src/modules/auth/types/auth.ts +31 -0
- package/fastify/src/providers/README.md +107 -0
- package/fastify/src/providers/notification.ts +4 -0
- package/fastify/src/resources/index.html +17 -0
- package/fastify/src/resources/src/App.vue +5 -0
- package/fastify/src/resources/src/assets/css/styles.css +14761 -0
- package/fastify/src/resources/src/assets/css/styles.css.map +1 -0
- package/fastify/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
- package/fastify/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
- package/fastify/src/resources/src/assets/images/favicon/favicon.ico +0 -0
- package/fastify/src/resources/src/assets/images/logo.png +0 -0
- package/fastify/src/resources/src/assets/scss/custom.css +217 -0
- package/fastify/src/resources/src/assets/scss/custom.css.map +1 -0
- package/fastify/src/resources/src/assets/scss/custom.scss +1346 -0
- package/fastify/src/resources/src/components/Button.vue +32 -0
- package/fastify/src/resources/src/components/Checkbox.vue +32 -0
- package/fastify/src/resources/src/components/Datepicker.vue +106 -0
- package/fastify/src/resources/src/components/FeatureButton.vue +53 -0
- package/fastify/src/resources/src/components/FloatButton.vue +33 -0
- package/fastify/src/resources/src/components/Href.vue +32 -0
- package/fastify/src/resources/src/components/Input.vue +243 -0
- package/fastify/src/resources/src/components/InputGroup.vue +147 -0
- package/fastify/src/resources/src/components/InputPasswordToggle.vue +229 -0
- package/fastify/src/resources/src/components/Modal.vue +71 -0
- package/fastify/src/resources/src/components/Pagebar.vue +26 -0
- package/fastify/src/resources/src/components/Refresh.vue +19 -0
- package/fastify/src/resources/src/components/Select.vue +384 -0
- package/fastify/src/resources/src/components/Spinner.vue +42 -0
- package/fastify/src/resources/src/components/Switch.vue +60 -0
- package/fastify/src/resources/src/components/TextArea.vue +117 -0
- package/fastify/src/resources/src/components/Toast.vue +56 -0
- package/fastify/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
- package/fastify/src/resources/src/components/datatable/Pagination.vue +147 -0
- package/fastify/src/resources/src/components/datatable/SelectOpption.vue +64 -0
- package/fastify/src/resources/src/components/datatable/index.vue +199 -0
- package/fastify/src/resources/src/composables/useAuth.ts +52 -0
- package/fastify/src/resources/src/helpers/assets.ts +51 -0
- package/fastify/src/resources/src/helpers/nformatter.ts +10 -0
- package/fastify/src/resources/src/helpers/utils.ts +75 -0
- package/fastify/src/resources/src/layouts/AuthLayout.vue +20 -0
- package/fastify/src/resources/src/layouts/Layout/Footer.vue +23 -0
- package/fastify/src/resources/src/layouts/Layout/Header.vue +124 -0
- package/fastify/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
- package/fastify/src/resources/src/layouts/Layout/index.vue +87 -0
- package/fastify/src/resources/src/main.ts +28 -0
- package/fastify/src/resources/src/pages/auth/forgetPassword.vue +76 -0
- package/fastify/src/resources/src/pages/auth/login.vue +96 -0
- package/fastify/src/resources/src/pages/auth/register.vue +129 -0
- package/fastify/src/resources/src/pages/auth/resetPassword.vue +110 -0
- package/fastify/src/resources/src/pages/auth/verifyEmail.vue +64 -0
- package/fastify/src/resources/src/pages/dashboard/index.vue +66 -0
- package/fastify/src/resources/src/plugins/axios.ts +31 -0
- package/fastify/src/resources/src/plugins/browserDetect.ts +55 -0
- package/fastify/src/resources/src/plugins/dialog.ts +216 -0
- package/fastify/src/resources/src/plugins/gum.ts +683 -0
- package/fastify/src/resources/src/plugins/pulse.ts +157 -0
- package/fastify/src/resources/src/plugins/routeProgress.ts +87 -0
- package/fastify/src/resources/src/router/index.ts +85 -0
- package/fastify/src/resources/src/stores/admin-ui.ts +148 -0
- package/fastify/src/resources/src/stores/auth.ts +187 -0
- package/fastify/src/resources/tsconfig.json +19 -0
- package/fastify/src/resources/vite.config.ts +64 -0
- package/fastify/src/storage/app/private/.gitkeep +0 -0
- package/fastify/src/storage/app/public/.gitkeep +0 -0
- package/fastify/src/storage/app/tmp/generated/.gitkeep +0 -0
- package/fastify/src/storage/database/nexwire.sqlite +0 -0
- package/fastify/src/storage/logs/.gitkeep +0 -0
- package/fastify/src/storage/logs/app.log +0 -0
- package/fastify/src/storage/logs/fatal.log +0 -0
- package/fastify/src/storage/tmp/.gitkeep +0 -0
- package/fastify/src/storage/trash/modules/.gitkeep +0 -0
- package/fastify/src/types/global.d.ts +32 -0
- package/fastify/tsconfig.json +19 -0
- package/fastify/vitest.config.ts +38 -0
- package/hono/.env +1 -1
- package/hono/package.json +1 -1
- package/hono/src/config/database.ts +48 -29
- package/hono/src/config/index.ts +83 -83
- package/hono/src/config/openapi.ts +6 -24
- package/hono/src/config/queue.ts +30 -30
- package/hono/src/config/validate.ts +50 -40
- package/hono/src/database/migrations/sqlite/0000_init.sql +47 -47
- package/hono/src/database/migrations/sqlite/meta/0000_snapshot.json +1 -1
- package/hono/src/database/migrations/sqlite/meta/_journal.json +1 -1
- package/hono/src/framework/cache/cache.ts +40 -8
- package/hono/src/framework/circuit-breaker/cb.ts +88 -60
- package/hono/src/framework/database/connection.ts +52 -27
- package/hono/src/framework/events/dispatcher.ts +61 -49
- package/hono/src/framework/facade.ts +39 -1
- package/hono/src/framework/http/logger.ts +86 -81
- package/hono/src/framework/http/openapi.ts +7 -9
- package/hono/src/framework/maker-cli/runtime/core.mjs +1 -2
- package/hono/src/framework/notification/channels/broadcast.ts +15 -0
- package/hono/src/framework/notification/channels/mail.ts +42 -0
- package/hono/src/framework/notification/contracts.ts +29 -0
- package/hono/src/framework/notification/index.ts +19 -94
- package/hono/src/framework/notification/registry.ts +15 -0
- package/hono/src/framework/providers/adapter.ts +27 -17
- package/hono/src/framework/queue/queue.ts +43 -44
- package/hono/src/framework/realtime/broadcast.ts +29 -5
- package/hono/src/framework/realtime/socket.ts +217 -196
- package/hono/src/framework/redis/client.ts +148 -151
- package/hono/src/framework/scheduler/lock.ts +128 -116
- package/hono/src/framework/server.ts +27 -29
- package/hono/src/framework/session/session.ts +62 -14
- package/hono/src/framework/storage/storage.ts +744 -785
- package/hono/src/framework/support/mail.ts +56 -48
- package/hono/src/middlewares/auth-middleware.ts +1 -2
- package/hono/src/middlewares/role-middleware.ts +3 -13
- package/hono/src/modules/auth/routes/index.ts +1 -2
- package/hono/src/providers/notification.ts +4 -0
- package/hono/src/resources/src/components/Switch.vue +60 -65
- package/hono/src/resources/src/layouts/Layout/Header.vue +124 -105
- package/hono/src/resources/src/pages/auth/forgetPassword.vue +23 -29
- package/hono/src/resources/src/pages/auth/login.vue +26 -29
- package/hono/src/resources/src/pages/auth/register.vue +36 -40
- package/hono/src/resources/src/pages/auth/resetPassword.vue +29 -37
- package/hono/src/resources/src/pages/auth/verifyEmail.vue +15 -19
- package/hono/src/resources/src/plugins/gum.ts +519 -203
- package/hono/src/resources/src/plugins/pulse.ts +157 -147
- package/hono/src/resources/src/stores/auth.ts +9 -6
- package/hono/src/resources/vite.config.ts +54 -43
- package/hono/src/storage/database/nexwire.sqlite +0 -0
- package/hono/src/storage/logs/app.log +0 -0
- package/hono/src/storage/logs/fatal.log +0 -0
- package/hono/src/types/global.d.ts +32 -26
- package/package.json +4 -3
- package/src/index.js +143 -15
|
@@ -5,7 +5,7 @@ import { appConfig, mailConfig, realtimeConfig, redisConfig } from "@/config/ind
|
|
|
5
5
|
import { createKernel } from "@/framework/kernel.js";
|
|
6
6
|
import { stopQueueRuntime } from "@/framework/queue/queue.js";
|
|
7
7
|
import { stopQueueDashboard } from "@/framework/queue/ui.js";
|
|
8
|
-
import { broadcast, closeRealtime,
|
|
8
|
+
import { broadcast, closeRealtime, socketServer, WS_PATH } from "@/framework/realtime/index.js";
|
|
9
9
|
import { setupSocketAdminUI } from "@/framework/realtime/ui.js";
|
|
10
10
|
import { closeRedis, redisClientIfReady, redisError, redisReady } from "@/framework/redis/client.js";
|
|
11
11
|
import { type HttpServerHandle, startHttpServer } from "@/framework/runtime/server-adapter.js";
|
|
@@ -14,23 +14,15 @@ import { logger } from "@/framework/support/logger.js";
|
|
|
14
14
|
|
|
15
15
|
const redisBackedServices = "cache, session, queue, events, Queue Dashboard";
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Why: Builds reliable local URL string for runtime service output.
|
|
19
|
-
* When: Printing API/docs/Queue Dashboard endpoints at startup.
|
|
20
|
-
* Where: Server runtime logging.
|
|
21
|
-
* How: Derives bound port from server address and normalizes hostname.
|
|
22
|
-
*/
|
|
23
17
|
function serverUrl(server: HttpServerHandle, pathname = "") {
|
|
24
18
|
const address = server.address();
|
|
25
19
|
const port = typeof address === "object" && address ? address.port : appConfig.port;
|
|
26
|
-
|
|
27
20
|
try {
|
|
28
21
|
const currentUrl = new URL(appConfig.url);
|
|
29
22
|
currentUrl.port = String(port);
|
|
30
23
|
if (currentUrl.hostname === "0.0.0.0" || currentUrl.hostname === "::") {
|
|
31
24
|
currentUrl.hostname = "localhost";
|
|
32
25
|
}
|
|
33
|
-
|
|
34
26
|
return `${currentUrl.toString().replace(/\/$/, "")}${pathname}`;
|
|
35
27
|
} catch {
|
|
36
28
|
return `http://localhost:${port}${pathname}`;
|
|
@@ -41,27 +33,22 @@ export interface ServerHandle {
|
|
|
41
33
|
app: Awaited<ReturnType<typeof createKernel>>["app"];
|
|
42
34
|
bullBoard: Awaited<ReturnType<typeof createKernel>>["bullBoard"];
|
|
43
35
|
server: HttpServerHandle;
|
|
44
|
-
realtime:
|
|
36
|
+
realtime: any; // Type for Express is simpler
|
|
45
37
|
broadcastSubClient: ReturnType<typeof redisClientIfReady> | null;
|
|
46
38
|
shutdown: (signal: ShutdownSignal) => Promise<void>;
|
|
47
39
|
closeHttpServer: () => Promise<void>;
|
|
48
40
|
}
|
|
49
41
|
|
|
50
|
-
/**
|
|
51
|
-
* Why: Starts the HTTP server and wires realtime/queue/redis shutdown.
|
|
52
|
-
* When: CLI `serve` command or E2E test bootstrap.
|
|
53
|
-
* Where: Server entrypoint.
|
|
54
|
-
* How: Creates kernel, starts HTTP, registers signal handlers, returns handle.
|
|
55
|
-
* When called as the main module, also prints startup banners.
|
|
56
|
-
*/
|
|
57
42
|
export async function startServer(): Promise<ServerHandle> {
|
|
58
43
|
const { app, bullBoard } = await createKernel();
|
|
59
44
|
|
|
60
|
-
|
|
45
|
+
// 1. Start the server (this internally attaches Socket.IO for Express)
|
|
61
46
|
const server = await startHttpServer(app, appConfig.port);
|
|
62
|
-
realtime = await initRealtime({ httpServer: server.native });
|
|
63
47
|
|
|
64
|
-
|
|
48
|
+
// 2. Grab the existing Socket.IO instance
|
|
49
|
+
const io = socketServer();
|
|
50
|
+
const realtime = io ? { io } : null;
|
|
51
|
+
const socketAdmin = setupSocketAdminUI(io);
|
|
65
52
|
|
|
66
53
|
let shuttingDown = false;
|
|
67
54
|
let broadcastSubClient: ReturnType<typeof redisClientIfReady> | null = null;
|
|
@@ -83,7 +70,9 @@ export async function startServer(): Promise<ServerHandle> {
|
|
|
83
70
|
}
|
|
84
71
|
broadcastSubClient = null;
|
|
85
72
|
}
|
|
86
|
-
|
|
73
|
+
|
|
74
|
+
// closeRealtime is handled by server.close() adapter
|
|
75
|
+
await Promise.allSettled([stopQueueRuntime(), closeHttpServer()]);
|
|
87
76
|
stopQueueDashboard();
|
|
88
77
|
await closeRedis();
|
|
89
78
|
|
|
@@ -111,57 +100,52 @@ export async function startServer(): Promise<ServerHandle> {
|
|
|
111
100
|
}
|
|
112
101
|
|
|
113
102
|
const views = new Set(parseCsvOrFallback(process.env.NEXWIRE_DEV_VIEWS, []).map((view) => view.toLowerCase()));
|
|
114
|
-
|
|
103
|
+
|
|
115
104
|
if (appConfig.openApiEnabled) {
|
|
116
105
|
console.log(`API Docs: ${serverUrl(server, "/api-docs")}`);
|
|
117
106
|
}
|
|
118
107
|
|
|
119
108
|
if (appConfig.uiEnabled) {
|
|
120
|
-
|
|
121
|
-
console.log(`UI: ${process.env.NEXWIRE_FRONTEND_URL}`);
|
|
122
|
-
} else {
|
|
123
|
-
console.log("UI enabled");
|
|
124
|
-
}
|
|
109
|
+
console.log(`UI: ${process.env.NEXWIRE_FRONTEND_URL}`);
|
|
125
110
|
} else {
|
|
126
|
-
console.log(chalk.gray("UI
|
|
111
|
+
console.log(chalk.gray("UI: .env -> UI=false (API-only mode)"));
|
|
127
112
|
}
|
|
128
113
|
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
if (redisConfig.enabled && bullBoard.enabled) {
|
|
115
|
+
console.log(`Queue: ${serverUrl(server, bullBoard.basePath)}`);
|
|
116
|
+
}
|
|
131
117
|
|
|
132
118
|
if (views.has("maildev")) {
|
|
133
|
-
|
|
134
|
-
const line = `${maildevLine} (requested; see dev process status)`;
|
|
135
|
-
console.log(redisWarnColor ? redisWarnColor(line) : line);
|
|
119
|
+
console.log(`MailDev: http://localhost:${mailConfig.maildev.webPort} (SMTP ${mailConfig.maildev.smtpPort})`);
|
|
136
120
|
}
|
|
137
121
|
|
|
138
122
|
if (views.has("studio")) {
|
|
139
|
-
console.log("Drizzle
|
|
123
|
+
console.log("Drizzle: https://local.drizzle.studio");
|
|
140
124
|
}
|
|
141
125
|
|
|
142
126
|
const wsUrl = serverUrl(server, WS_PATH).replace(/^http/, "ws");
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
127
|
+
if (!realtimeConfig.enabled) {
|
|
128
|
+
console.log(chalk.gray("Realtime (Socket.IO) disabled"));
|
|
129
|
+
} else if (realtime) {
|
|
130
|
+
if (socketAdmin.enabled) {
|
|
131
|
+
console.log(`Realtime: https://admin.socket.io | ${wsUrl}`);
|
|
132
|
+
} else {
|
|
133
|
+
console.log(`Realtime: ${wsUrl}`);
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
console.log(chalk.yellow("Realtime (Socket.IO) unavailable"));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (redisConfig.enabled && views.has("redis")) {
|
|
140
|
+
console.log(`Redis UI: http://localhost:${redisConfig.commanderPort}`);
|
|
154
141
|
}
|
|
155
142
|
|
|
156
143
|
if (!redisConfig.enabled) {
|
|
157
|
-
|
|
158
|
-
console.log(chalk.cyan("Redis disabled (configured in src/config/redis.ts)"));
|
|
159
|
-
console.log(chalk.cyan(`Redis-backed services disabled: ${redisBackedServices}`));
|
|
144
|
+
console.log(chalk.cyan(`Redis: .env -> REDIS=false (disabled ${redisBackedServices})`));
|
|
160
145
|
} else if (redisReady()) {
|
|
161
146
|
console.log(chalk.green(`Redis connected: ${redisConfig.url}`));
|
|
162
147
|
console.log(chalk.green(`Redis-backed services enabled: ${redisBackedServices}`));
|
|
163
148
|
} else {
|
|
164
|
-
redisWarnColor = chalk.yellow;
|
|
165
149
|
console.log(chalk.yellow(`Redis unavailable: ${redisError() || "not connected"}`));
|
|
166
150
|
console.log(chalk.yellow(`Redis-backed services unavailable: ${redisBackedServices}`));
|
|
167
151
|
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import type { NextFunction, Request, Response } from "express";
|
|
3
3
|
import { appConfig, redisConfig, sessionConfig } from "@/config/index.js";
|
|
4
|
+
import { createCircuitBreaker, isCircuitBreakerError } from "@/framework/circuit-breaker/cb.js";
|
|
4
5
|
import { redisClientIfReady } from "@/framework/redis/client.js";
|
|
5
6
|
|
|
7
|
+
// Initialize the breaker for Session operations
|
|
8
|
+
const sessionBreaker = createCircuitBreaker({
|
|
9
|
+
name: "Redis Session",
|
|
10
|
+
failureThreshold: 3,
|
|
11
|
+
resetTimeout: 30000
|
|
12
|
+
});
|
|
13
|
+
|
|
6
14
|
function originOf(url?: string) {
|
|
7
15
|
if (!url) return "";
|
|
8
16
|
try {
|
|
@@ -22,6 +30,9 @@ function sessionKey(id: string) {
|
|
|
22
30
|
return `${sessionConfig.keyPrefix}:${id}`;
|
|
23
31
|
}
|
|
24
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Global middleware that ensures every request has a session cookie.
|
|
35
|
+
*/
|
|
25
36
|
export async function sessionMiddleware(req: Request, res: Response, next: NextFunction) {
|
|
26
37
|
let sessionId = req.cookies?.[sessionConfig.cookieName];
|
|
27
38
|
|
|
@@ -38,26 +49,44 @@ export async function sessionMiddleware(req: Request, res: Response, next: NextF
|
|
|
38
49
|
}
|
|
39
50
|
|
|
40
51
|
res.locals.sessionId = sessionId;
|
|
52
|
+
|
|
53
|
+
// Refresh is safely wrapped in the breaker internally
|
|
41
54
|
await session.refresh(sessionId);
|
|
55
|
+
|
|
42
56
|
next();
|
|
43
57
|
}
|
|
44
58
|
|
|
59
|
+
/** Redis-backed server-side session store. */
|
|
45
60
|
export const session = {
|
|
46
61
|
async start(data: Record<string, unknown> = {}) {
|
|
47
62
|
const client = redisClientIfReady();
|
|
48
63
|
if (!client) return "";
|
|
49
64
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
try {
|
|
66
|
+
return await sessionBreaker.exec(async () => {
|
|
67
|
+
const id = randomUUID();
|
|
68
|
+
await client.set(sessionKey(id), JSON.stringify(data), "EX", sessionConfig.ttlSeconds);
|
|
69
|
+
return id;
|
|
70
|
+
});
|
|
71
|
+
} catch (error) {
|
|
72
|
+
if (isCircuitBreakerError(error)) return "";
|
|
73
|
+
return "";
|
|
74
|
+
}
|
|
53
75
|
},
|
|
54
76
|
|
|
55
77
|
async all<T = Record<string, unknown>>(id: string): Promise<T | null> {
|
|
56
78
|
const client = redisClientIfReady();
|
|
57
79
|
if (!client) return null;
|
|
58
80
|
|
|
59
|
-
|
|
60
|
-
|
|
81
|
+
try {
|
|
82
|
+
return await sessionBreaker.exec(async () => {
|
|
83
|
+
const data = await client.get(sessionKey(id));
|
|
84
|
+
return data ? (JSON.parse(data) as T) : null;
|
|
85
|
+
});
|
|
86
|
+
} catch (error) {
|
|
87
|
+
if (isCircuitBreakerError(error)) return null;
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
61
90
|
},
|
|
62
91
|
|
|
63
92
|
async get<T>(id: string, key: string): Promise<T | null> {
|
|
@@ -69,10 +98,22 @@ export const session = {
|
|
|
69
98
|
const client = redisClientIfReady();
|
|
70
99
|
if (!client) return false;
|
|
71
100
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
101
|
+
try {
|
|
102
|
+
return await sessionBreaker.exec(async () => {
|
|
103
|
+
// Read through the client directly rather than `session.all()`. Calling
|
|
104
|
+
// another breaker-wrapped method from inside `exec` deadlocks the
|
|
105
|
+
// half-open probe: the inner call sees the outer probe in flight and
|
|
106
|
+
// rejects, so a `set` could never be the call that closes the breaker.
|
|
107
|
+
const raw = await client.get(sessionKey(id));
|
|
108
|
+
const data = raw ? (JSON.parse(raw) as Record<string, unknown>) : {};
|
|
109
|
+
data[key] = value;
|
|
110
|
+
await client.set(sessionKey(id), JSON.stringify(data), "EX", sessionConfig.ttlSeconds);
|
|
111
|
+
return true;
|
|
112
|
+
});
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (isCircuitBreakerError(error)) return false;
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
76
117
|
},
|
|
77
118
|
|
|
78
119
|
/** @deprecated Use set() instead. */
|
|
@@ -84,19 +125,33 @@ export const session = {
|
|
|
84
125
|
const client = redisClientIfReady();
|
|
85
126
|
if (!client) return false;
|
|
86
127
|
|
|
87
|
-
|
|
88
|
-
|
|
128
|
+
try {
|
|
129
|
+
return await sessionBreaker.exec(async () => {
|
|
130
|
+
await client.expire(sessionKey(id), sessionConfig.ttlSeconds);
|
|
131
|
+
return true;
|
|
132
|
+
});
|
|
133
|
+
} catch (error) {
|
|
134
|
+
if (isCircuitBreakerError(error)) return false;
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
89
137
|
},
|
|
90
138
|
|
|
91
139
|
async destroy(id: string) {
|
|
92
140
|
const client = redisClientIfReady();
|
|
93
141
|
if (!client) return false;
|
|
94
142
|
|
|
95
|
-
|
|
96
|
-
|
|
143
|
+
try {
|
|
144
|
+
return await sessionBreaker.exec(async () => {
|
|
145
|
+
await client.del(sessionKey(id));
|
|
146
|
+
return true;
|
|
147
|
+
});
|
|
148
|
+
} catch (error) {
|
|
149
|
+
if (isCircuitBreakerError(error)) return false;
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
97
152
|
},
|
|
98
153
|
|
|
99
154
|
isAvailable() {
|
|
100
|
-
return redisConfig.enabled && redisClientIfReady() !== null;
|
|
155
|
+
return redisConfig.enabled && redisClientIfReady() !== null && sessionBreaker.getState() !== "open";
|
|
101
156
|
}
|
|
102
157
|
};
|