@vitnode/core 1.2.0-canary.52 → 1.2.0-canary.54
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/config/next.config.ts +3 -3
- package/dist/scripts/get-config.d.ts +2 -2
- package/dist/scripts/get-config.d.ts.map +1 -1
- package/dist/scripts/plugin.d.ts.map +1 -1
- package/dist/scripts/prepare-database.d.ts +0 -1
- package/dist/scripts/prepare-database.d.ts.map +1 -1
- package/dist/scripts/prepare-plugins-files.d.ts.map +1 -1
- package/dist/scripts/scripts.js +3 -3
- package/dist/scripts/shared/file-utils.d.ts.map +1 -1
- package/dist/src/api/adapters/cron/node-cron.adapter.d.ts +3 -0
- package/dist/src/api/adapters/cron/node-cron.adapter.d.ts.map +1 -0
- package/dist/src/api/adapters/cron/node-cron.adapter.js +11 -0
- package/dist/src/api/adapters/email/nodemailer.d.ts +1 -1
- package/dist/src/api/adapters/email/nodemailer.js +3 -3
- package/dist/src/api/adapters/email/resend.d.ts +1 -1
- package/dist/src/api/adapters/email/resend.js +2 -2
- package/dist/src/api/adapters/sso/discord.d.ts +1 -1
- package/dist/src/api/adapters/sso/discord.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/discord.js +21 -21
- package/dist/src/api/adapters/sso/facebook.d.ts +1 -1
- package/dist/src/api/adapters/sso/facebook.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/facebook.js +23 -23
- package/dist/src/api/adapters/sso/google.d.ts +1 -1
- package/dist/src/api/adapters/sso/google.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/google.js +21 -21
- package/dist/src/api/config.d.ts +3 -3
- package/dist/src/api/config.d.ts.map +1 -1
- package/dist/src/api/config.js +30 -18
- package/dist/src/api/lib/check-plugin-id.js +8 -8
- package/dist/src/api/lib/cron.d.ts +18 -0
- package/dist/src/api/lib/cron.d.ts.map +1 -0
- package/dist/src/api/lib/cron.js +22 -0
- package/dist/src/api/lib/logger-middleware.d.ts +1 -1
- package/dist/src/api/lib/logger-middleware.js +9 -9
- package/dist/src/api/lib/module.d.ts +6 -3
- package/dist/src/api/lib/module.d.ts.map +1 -1
- package/dist/src/api/lib/module.js +3 -2
- package/dist/src/api/lib/plugin.d.ts +4 -2
- package/dist/src/api/lib/plugin.d.ts.map +1 -1
- package/dist/src/api/lib/plugin.js +9 -1
- package/dist/src/api/lib/route.d.ts +2 -2
- package/dist/src/api/lib/route.d.ts.map +1 -1
- package/dist/src/api/lib/route.js +1 -1
- package/dist/src/api/lib/with-pagination.d.ts +7 -7
- package/dist/src/api/lib/with-pagination.d.ts.map +1 -1
- package/dist/src/api/lib/with-pagination.js +37 -24
- package/dist/src/api/middlewares/captcha.middleware.d.ts +1 -1
- package/dist/src/api/middlewares/captcha.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/captcha.middleware.js +14 -13
- package/dist/src/api/middlewares/cron-auth.middleware.d.ts +3 -0
- package/dist/src/api/middlewares/cron-auth.middleware.d.ts.map +1 -0
- package/dist/src/api/middlewares/cron-auth.middleware.js +19 -0
- package/dist/src/api/middlewares/global.middleware.d.ts +18 -12
- package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/global.middleware.js +46 -34
- package/dist/src/api/middlewares/rate-limiter.middleware.d.ts +3 -3
- package/dist/src/api/middlewares/rate-limiter.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/rate-limiter.middleware.js +4 -4
- package/dist/src/api/models/device.d.ts +1 -1
- package/dist/src/api/models/device.d.ts.map +1 -1
- package/dist/src/api/models/device.js +13 -13
- package/dist/src/api/models/email.d.ts +15 -15
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +11 -10
- package/dist/src/api/models/password.js +9 -9
- package/dist/src/api/models/session-admin.d.ts +1 -1
- package/dist/src/api/models/session-admin.d.ts.map +1 -1
- package/dist/src/api/models/session-admin.js +19 -19
- package/dist/src/api/models/session.d.ts +1 -1
- package/dist/src/api/models/session.d.ts.map +1 -1
- package/dist/src/api/models/session.js +17 -17
- package/dist/src/api/models/sso.d.ts +1 -1
- package/dist/src/api/models/sso.d.ts.map +1 -1
- package/dist/src/api/models/sso.js +22 -25
- package/dist/src/api/models/user/get-user-by-id.d.ts +1 -1
- package/dist/src/api/models/user/get-user-by-id.d.ts.map +1 -1
- package/dist/src/api/models/user/get-user-by-id.js +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.js +1 -1
- package/dist/src/api/models/user/sign-up.d.ts +2 -2
- package/dist/src/api/models/user/sign-up.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-up.js +11 -12
- package/dist/src/api/models/user.d.ts +1 -1
- package/dist/src/api/models/user.d.ts.map +1 -1
- package/dist/src/api/modules/admin/admin.module.d.ts +166 -4
- package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -1
- package/dist/src/api/modules/admin/admin.module.js +7 -4
- package/dist/src/api/modules/admin/advanced/advanced.admin.module.d.ts +164 -0
- package/dist/src/api/modules/admin/advanced/advanced.admin.module.d.ts.map +1 -0
- package/dist/src/api/modules/admin/advanced/advanced.admin.module.js +11 -0
- package/dist/src/api/modules/admin/advanced/cron/cron.admin.module.d.ts +164 -0
- package/dist/src/api/modules/admin/advanced/cron/cron.admin.module.d.ts.map +1 -0
- package/dist/src/api/modules/admin/advanced/cron/cron.admin.module.js +12 -0
- package/dist/src/api/modules/admin/advanced/cron/routes/get.route.d.ts +98 -0
- package/dist/src/api/modules/admin/advanced/cron/routes/get.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/advanced/cron/routes/get.route.js +66 -0
- package/dist/src/api/modules/admin/advanced/cron/routes/run.route.d.ts +70 -0
- package/dist/src/api/modules/admin/advanced/cron/routes/run.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/advanced/cron/routes/run.route.js +95 -0
- package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts +1 -1
- package/dist/src/api/modules/admin/debug/debug.admin.module.js +2 -2
- package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts +2 -2
- package/dist/src/api/modules/admin/debug/routes/logs.route.js +17 -17
- package/dist/src/api/modules/admin/routes/session.route.d.ts +2 -2
- package/dist/src/api/modules/admin/routes/session.route.js +8 -8
- package/dist/src/api/modules/admin/users/routes/list.route.d.ts +2 -2
- package/dist/src/api/modules/admin/users/routes/list.route.js +13 -13
- package/dist/src/api/modules/admin/users/routes/users.route.d.ts +5 -5
- package/dist/src/api/modules/admin/users/routes/users.route.js +16 -16
- package/dist/src/api/modules/admin/users/users.admin.module.d.ts +1 -1
- package/dist/src/api/modules/admin/users/users.admin.module.js +2 -2
- package/dist/src/api/modules/cron/cron/clean.cron.d.ts +2 -0
- package/dist/src/api/modules/cron/cron/clean.cron.d.ts.map +1 -0
- package/dist/src/api/modules/cron/cron/clean.cron.js +24 -0
- package/dist/src/api/modules/cron/cron.module.d.ts +26 -0
- package/dist/src/api/modules/cron/cron.module.d.ts.map +1 -0
- package/dist/src/api/modules/cron/cron.module.js +14 -0
- package/dist/src/api/modules/cron/helpers/process-cron-jobs.d.ts +36 -0
- package/dist/src/api/modules/cron/helpers/process-cron-jobs.d.ts.map +1 -0
- package/dist/src/api/modules/cron/helpers/process-cron-jobs.js +72 -0
- package/dist/src/api/modules/cron/routes/cron.route.d.ts +27 -0
- package/dist/src/api/modules/cron/routes/cron.route.d.ts.map +1 -0
- package/dist/src/api/modules/cron/routes/cron.route.js +95 -0
- package/dist/src/api/modules/middleware/middleware.module.d.ts +1 -1
- package/dist/src/api/modules/middleware/middleware.module.js +2 -2
- package/dist/src/api/modules/middleware/route.d.ts +2 -2
- package/dist/src/api/modules/middleware/route.js +13 -13
- package/dist/src/api/modules/users/routes/change-password.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/change-password.route.js +14 -14
- package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/reset-passowrd.route.js +18 -18
- package/dist/src/api/modules/users/routes/session.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/session.route.js +7 -7
- package/dist/src/api/modules/users/routes/sign-in.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/sign-in.route.js +11 -11
- package/dist/src/api/modules/users/routes/sign-out.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/sign-out.route.js +8 -8
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/sign-up.route.js +15 -15
- package/dist/src/api/modules/users/routes/test.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/test.route.js +10 -10
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +2 -2
- package/dist/src/api/modules/users/sso/routes/callback.route.js +9 -9
- package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts +2 -2
- package/dist/src/api/modules/users/sso/routes/create-url.route.js +7 -7
- package/dist/src/api/modules/users/sso/sso.module.d.ts +2 -2
- package/dist/src/api/modules/users/sso/sso.module.js +2 -2
- package/dist/src/api/modules/users/users.module.d.ts +12 -12
- package/dist/src/api/modules/users/users.module.js +2 -2
- package/dist/src/api/plugin.d.ts.map +1 -1
- package/dist/src/api/plugin.js +4 -2
- package/dist/src/app/login/page.d.ts +1 -1
- package/dist/src/app/login/page.js +2 -2
- package/dist/src/app/login/reset-password/page.d.ts +2 -2
- package/dist/src/app/login/reset-password/page.js +2 -2
- package/dist/src/app/register/page.d.ts +1 -1
- package/dist/src/app/register/page.js +2 -2
- package/dist/src/app_admin/core/advanced/cron/page.d.ts +11 -0
- package/dist/src/app_admin/core/advanced/cron/page.d.ts.map +1 -0
- package/dist/src/app_admin/core/advanced/cron/page.js +42 -0
- package/dist/src/app_admin/core/debug/page.d.ts +1 -1
- package/dist/src/app_admin/core/debug/page.js +8 -8
- package/dist/src/app_admin/core/users/page.d.ts +2 -2
- package/dist/src/app_admin/core/users/page.d.ts.map +1 -1
- package/dist/src/app_admin/core/users/page.js +7 -7
- package/dist/src/components/avatar.d.ts +1 -1
- package/dist/src/components/avatar.js +1 -1
- package/dist/src/components/confirm-action/confirm-action-alert-dialog.d.ts +2 -2
- package/dist/src/components/confirm-action/confirm-action-alert-dialog.js +5 -5
- package/dist/src/components/confirm-action/content.d.ts.map +1 -1
- package/dist/src/components/confirm-action/content.js +3 -4
- package/dist/src/components/date-format.js +8 -8
- package/dist/src/components/form/auto-form.d.ts +16 -16
- package/dist/src/components/form/auto-form.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.js +13 -12
- package/dist/src/components/form/common/desc.js +1 -1
- package/dist/src/components/form/common/label.d.ts +1 -1
- package/dist/src/components/form/common/label.js +1 -1
- package/dist/src/components/form/fields/checkbox.d.ts +2 -2
- package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.d.ts +3 -3
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.js +29 -23
- package/dist/src/components/form/fields/combobox.d.ts +3 -3
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.js +6 -7
- package/dist/src/components/form/fields/input.d.ts +2 -2
- package/dist/src/components/form/fields/input.d.ts.map +1 -1
- package/dist/src/components/form/fields/input.js +2 -2
- package/dist/src/components/form/fields/radio-group.d.ts +3 -3
- package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
- package/dist/src/components/form/fields/radio-group.js +0 -1
- package/dist/src/components/form/fields/select.d.ts +3 -3
- package/dist/src/components/form/fields/select.d.ts.map +1 -1
- package/dist/src/components/form/fields/select.js +2 -3
- package/dist/src/components/form/fields/switch.d.ts +2 -2
- package/dist/src/components/form/fields/switch.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.d.ts +3 -3
- package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.js +1 -2
- package/dist/src/components/i18n-provider.d.ts +2 -2
- package/dist/src/components/i18n-provider.js +3 -3
- package/dist/src/components/logo-vitnode.d.ts.map +1 -1
- package/dist/src/components/logo-vitnode.js +8 -2
- package/dist/src/components/switchers/langs/{language-swietcher.d.ts → language-switcher.d.ts} +2 -2
- package/dist/src/components/switchers/langs/language-switcher.d.ts.map +1 -0
- package/dist/src/components/switchers/langs/{language-swietcher.js → language-switcher.js} +3 -3
- package/dist/src/components/switchers/themes/theme-switcher.js +4 -4
- package/dist/src/components/table/content.d.ts +1 -1
- package/dist/src/components/table/content.d.ts.map +1 -1
- package/dist/src/components/table/content.js +5 -5
- package/dist/src/components/table/data-table.d.ts +7 -7
- package/dist/src/components/table/data-table.d.ts.map +1 -1
- package/dist/src/components/table/data-table.js +22 -15
- package/dist/src/components/table/order-table-head.d.ts +4 -4
- package/dist/src/components/table/order-table-head.d.ts.map +1 -1
- package/dist/src/components/table/order-table-head.js +20 -9
- package/dist/src/components/table/pagination.js +19 -19
- package/dist/src/components/tiptap/extension.d.ts +4 -0
- package/dist/src/components/tiptap/extension.d.ts.map +1 -0
- package/dist/src/components/tiptap/extension.js +26 -0
- package/dist/src/components/tiptap/toolbar/actions/bold-action.d.ts +2 -0
- package/dist/src/components/tiptap/toolbar/actions/bold-action.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/bold-action.js +39 -0
- package/dist/src/components/tiptap/toolbar/actions/headings-action.d.ts +2 -0
- package/dist/src/components/tiptap/toolbar/actions/headings-action.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/headings-action.js +94 -0
- package/dist/src/components/tiptap/toolbar/actions/italic-action.d.ts +2 -0
- package/dist/src/components/tiptap/toolbar/actions/italic-action.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/italic-action.js +38 -0
- package/dist/src/components/tiptap/toolbar/actions/list-action.d.ts +2 -0
- package/dist/src/components/tiptap/toolbar/actions/list-action.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/list-action.js +60 -0
- package/dist/src/components/tiptap/toolbar/actions/text-format-more/text-format-more.d.ts +2 -0
- package/dist/src/components/tiptap/toolbar/actions/text-format-more/text-format-more.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/text-format-more/text-format-more.js +59 -0
- package/dist/src/components/tiptap/toolbar/actions/underline-action.d.ts +2 -0
- package/dist/src/components/tiptap/toolbar/actions/underline-action.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/underline-action.js +38 -0
- package/dist/src/components/tiptap/toolbar/actions/undo-redo-actions.d.ts +2 -0
- package/dist/src/components/tiptap/toolbar/actions/undo-redo-actions.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/undo-redo-actions.js +63 -0
- package/dist/src/components/tiptap/toolbar/actions/utils/tooltip-shortcut.d.ts +4 -0
- package/dist/src/components/tiptap/toolbar/actions/utils/tooltip-shortcut.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/utils/tooltip-shortcut.js +11 -0
- package/dist/src/components/tiptap/toolbar/tiptap-toolbar.d.ts +5 -0
- package/dist/src/components/tiptap/toolbar/tiptap-toolbar.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/tiptap-toolbar.js +35 -0
- package/dist/src/components/tiptap/toolbar/use-toolbar-editor.d.ts +9 -0
- package/dist/src/components/tiptap/toolbar/use-toolbar-editor.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/use-toolbar-editor.js +5 -0
- package/dist/src/components/ui/accordion.d.ts +2 -2
- package/dist/src/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/components/ui/accordion.js +4 -5
- package/dist/src/components/ui/alert-dialog.d.ts +7 -7
- package/dist/src/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/components/ui/alert-dialog.js +12 -12
- package/dist/src/components/ui/alert.d.ts +5 -5
- package/dist/src/components/ui/alert.d.ts.map +1 -1
- package/dist/src/components/ui/alert.js +6 -7
- package/dist/src/components/ui/badge.d.ts +3 -3
- package/dist/src/components/ui/badge.d.ts.map +1 -1
- package/dist/src/components/ui/badge.js +7 -8
- package/dist/src/components/ui/button-client.d.ts +1 -1
- package/dist/src/components/ui/button-client.d.ts.map +1 -1
- package/dist/src/components/ui/button-client.js +10 -10
- package/dist/src/components/ui/button.d.ts +8 -8
- package/dist/src/components/ui/button.d.ts.map +1 -1
- package/dist/src/components/ui/button.js +14 -15
- package/dist/src/components/ui/card.d.ts +8 -8
- package/dist/src/components/ui/card.js +7 -7
- package/dist/src/components/ui/checkbox.d.ts +2 -2
- package/dist/src/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/components/ui/checkbox.js +2 -3
- package/dist/src/components/ui/collapsible.d.ts +1 -1
- package/dist/src/components/ui/collapsible.js +1 -1
- package/dist/src/components/ui/command.d.ts +4 -4
- package/dist/src/components/ui/command.d.ts.map +1 -1
- package/dist/src/components/ui/command.js +9 -10
- package/dist/src/components/ui/context-menu.d.ts +4 -4
- package/dist/src/components/ui/context-menu.d.ts.map +1 -1
- package/dist/src/components/ui/context-menu.js +7 -8
- package/dist/src/components/ui/dialog.d.ts +6 -6
- package/dist/src/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/components/ui/dialog.js +16 -16
- package/dist/src/components/ui/drawer.d.ts +4 -4
- package/dist/src/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/components/ui/drawer.js +7 -8
- package/dist/src/components/ui/dropdown-menu.d.ts +4 -4
- package/dist/src/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/components/ui/dropdown-menu.js +8 -9
- package/dist/src/components/ui/editor-content.d.ts +4 -0
- package/dist/src/components/ui/editor-content.d.ts.map +1 -0
- package/dist/src/components/ui/editor-content.js +10 -0
- package/dist/src/components/ui/editor.d.ts +6 -0
- package/dist/src/components/ui/editor.d.ts.map +1 -0
- package/dist/src/components/ui/editor.js +35 -0
- package/dist/src/components/ui/form.d.ts +10 -10
- package/dist/src/components/ui/form.d.ts.map +1 -1
- package/dist/src/components/ui/form.js +15 -15
- package/dist/src/components/ui/header-content.js +1 -1
- package/dist/src/components/ui/hover-card.d.ts +2 -2
- package/dist/src/components/ui/hover-card.d.ts.map +1 -1
- package/dist/src/components/ui/hover-card.js +3 -4
- package/dist/src/components/ui/input-otp.d.ts +5 -5
- package/dist/src/components/ui/input-otp.d.ts.map +1 -1
- package/dist/src/components/ui/input-otp.js +6 -7
- package/dist/src/components/ui/input.d.ts +2 -2
- package/dist/src/components/ui/input.d.ts.map +1 -1
- package/dist/src/components/ui/input.js +1 -2
- package/dist/src/components/ui/label.d.ts +2 -2
- package/dist/src/components/ui/label.d.ts.map +1 -1
- package/dist/src/components/ui/label.js +2 -3
- package/dist/src/components/ui/loader.js +3 -3
- package/dist/src/components/ui/menubar.d.ts +4 -4
- package/dist/src/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/components/ui/menubar.js +11 -12
- package/dist/src/components/ui/navigation-menu.d.ts +2 -2
- package/dist/src/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/src/components/ui/navigation-menu.js +10 -11
- package/dist/src/components/ui/popover.d.ts +2 -2
- package/dist/src/components/ui/popover.d.ts.map +1 -1
- package/dist/src/components/ui/popover.js +3 -4
- package/dist/src/components/ui/progress.d.ts +2 -2
- package/dist/src/components/ui/progress.d.ts.map +1 -1
- package/dist/src/components/ui/progress.js +2 -3
- package/dist/src/components/ui/radio-group.d.ts +2 -2
- package/dist/src/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/components/ui/radio-group.js +3 -4
- package/dist/src/components/ui/select.d.ts +3 -3
- package/dist/src/components/ui/select.d.ts.map +1 -1
- package/dist/src/components/ui/select.js +9 -10
- package/dist/src/components/ui/separator.d.ts +2 -2
- package/dist/src/components/ui/separator.d.ts.map +1 -1
- package/dist/src/components/ui/separator.js +3 -4
- package/dist/src/components/ui/sheet.d.ts +5 -5
- package/dist/src/components/ui/sheet.d.ts.map +1 -1
- package/dist/src/components/ui/sheet.js +8 -9
- package/dist/src/components/ui/sidebar.d.ts +31 -31
- package/dist/src/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/components/ui/sidebar.js +78 -80
- package/dist/src/components/ui/skeleton.d.ts +1 -1
- package/dist/src/components/ui/skeleton.js +1 -1
- package/dist/src/components/ui/slider.d.ts +2 -2
- package/dist/src/components/ui/slider.d.ts.map +1 -1
- package/dist/src/components/ui/slider.js +16 -8
- package/dist/src/components/ui/sonner.d.ts +1 -1
- package/dist/src/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/components/ui/sonner.js +6 -6
- package/dist/src/components/ui/switch.d.ts +2 -2
- package/dist/src/components/ui/switch.d.ts.map +1 -1
- package/dist/src/components/ui/switch.js +3 -4
- package/dist/src/components/ui/table.d.ts +9 -9
- package/dist/src/components/ui/table.d.ts.map +1 -1
- package/dist/src/components/ui/table.js +8 -9
- package/dist/src/components/ui/tabs.d.ts +2 -2
- package/dist/src/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/components/ui/tabs.js +4 -5
- package/dist/src/components/ui/textarea.d.ts +2 -2
- package/dist/src/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/components/ui/textarea.js +1 -2
- package/dist/src/components/ui/toggle-group.d.ts +4 -4
- package/dist/src/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/components/ui/toggle-group.js +6 -6
- package/dist/src/components/ui/toggle.d.ts +3 -3
- package/dist/src/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/components/ui/toggle.js +8 -9
- package/dist/src/components/ui/tooltip.d.ts +6 -3
- package/dist/src/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/components/ui/tooltip.js +20 -5
- package/dist/src/config.js +2 -2
- package/dist/src/database/admins.js +10 -10
- package/dist/src/database/cron.d.ts +171 -0
- package/dist/src/database/cron.d.ts.map +1 -0
- package/dist/src/database/cron.js +22 -0
- package/dist/src/database/languages.js +7 -7
- package/dist/src/database/logs.js +9 -9
- package/dist/src/database/moderators.js +5 -5
- package/dist/src/database/roles.js +1 -1
- package/dist/src/database/sessions.js +6 -6
- package/dist/src/database/users.d.ts +2 -2
- package/dist/src/database/users.js +14 -14
- package/dist/src/drizzle.config.d.ts +2 -2
- package/dist/src/drizzle.config.d.ts.map +1 -1
- package/dist/src/drizzle.config.js +19 -12
- package/dist/src/emails/default-template.d.ts +3 -3
- package/dist/src/emails/default-template.d.ts.map +1 -1
- package/dist/src/emails/default-template.js +39 -38
- package/dist/src/emails/reset-password.d.ts +1 -1
- package/dist/src/emails/reset-password.d.ts.map +1 -1
- package/dist/src/emails/reset-password.js +51 -51
- package/dist/src/emails/ui/button.d.ts +2 -2
- package/dist/src/emails/ui/button.js +13 -13
- package/dist/src/emails/ui/card.d.ts +1 -1
- package/dist/src/emails/ui/card.js +6 -6
- package/dist/src/hooks/use-before-unload.js +3 -3
- package/dist/src/hooks/use-captcha.d.ts +2 -2
- package/dist/src/hooks/use-captcha.d.ts.map +1 -1
- package/dist/src/hooks/use-captcha.js +29 -37
- package/dist/src/hooks/use-mobile.d.ts.map +1 -1
- package/dist/src/hooks/use-mobile.js +3 -4
- package/dist/src/lib/api/get-middleware-api.js +4 -4
- package/dist/src/lib/api/get-next-cron-run-date.d.ts +2 -0
- package/dist/src/lib/api/get-next-cron-run-date.d.ts.map +1 -0
- package/dist/src/lib/api/get-next-cron-run-date.js +14 -0
- package/dist/src/lib/api/get-next-cron-run-date.test.d.ts +2 -0
- package/dist/src/lib/api/get-next-cron-run-date.test.d.ts.map +1 -0
- package/dist/src/lib/api/get-next-cron-run-date.test.js +55 -0
- package/dist/src/lib/api/get-session-admin-api.js +5 -5
- package/dist/src/lib/api/get-session-api.js +4 -4
- package/dist/src/lib/api/should-cron-job-run.d.ts +2 -0
- package/dist/src/lib/api/should-cron-job-run.d.ts.map +1 -0
- package/dist/src/lib/api/should-cron-job-run.js +16 -0
- package/dist/src/lib/api/should-cron-job-run.test.d.ts +2 -0
- package/dist/src/lib/api/should-cron-job-run.test.d.ts.map +1 -0
- package/dist/src/lib/api/should-cron-job-run.test.js +213 -0
- package/dist/src/lib/colors.js +28 -19
- package/dist/src/lib/colors.test.js +60 -60
- package/dist/src/lib/config.d.ts +1 -0
- package/dist/src/lib/config.d.ts.map +1 -1
- package/dist/src/lib/config.js +8 -6
- package/dist/src/lib/ctrl-or-command-character.d.ts +2 -0
- package/dist/src/lib/ctrl-or-command-character.d.ts.map +1 -0
- package/dist/src/lib/ctrl-or-command-character.js +9 -0
- package/dist/src/lib/fetcher/cookie-from-string-to-object.d.ts.map +1 -1
- package/dist/src/lib/fetcher/cookie-from-string-to-object.js +1 -1
- package/dist/src/lib/fetcher/cookie-from-string-to-object.test.js +27 -27
- package/dist/src/lib/fetcher/core.d.ts +5 -5
- package/dist/src/lib/fetcher/core.d.ts.map +1 -1
- package/dist/src/lib/fetcher/core.js +11 -10
- package/dist/src/lib/fetcher/helpers-server.d.ts +1 -1
- package/dist/src/lib/fetcher/helpers-server.js +1 -1
- package/dist/src/lib/fetcher/helpers.test.js +17 -17
- package/dist/src/lib/fetcher/types.d.ts +26 -26
- package/dist/src/lib/fetcher/types.d.ts.map +1 -1
- package/dist/src/lib/fetcher-client.d.ts +4 -4
- package/dist/src/lib/fetcher-client.d.ts.map +1 -1
- package/dist/src/lib/fetcher-client.js +3 -3
- package/dist/src/lib/fetcher.d.ts +5 -5
- package/dist/src/lib/fetcher.d.ts.map +1 -1
- package/dist/src/lib/fetcher.js +4 -4
- package/dist/src/lib/helpers/auto-form.d.ts +3 -3
- package/dist/src/lib/helpers/auto-form.d.ts.map +1 -1
- package/dist/src/lib/helpers/auto-form.js +16 -15
- package/dist/src/lib/helpers/auto-form.test.js +129 -129
- package/dist/src/lib/navigation.d.ts +3 -3
- package/dist/src/lib/navigation.d.ts.map +1 -1
- package/dist/src/lib/plugin.d.ts +3 -3
- package/dist/src/lib/special-characters.js +1 -1
- package/dist/src/lib/special-characters.test.js +36 -36
- package/dist/src/lib/utils.d.ts +1 -1
- package/dist/src/tests/setup.d.ts +1 -1
- package/dist/src/views/admin/layouts/admin-layout.d.ts +1 -1
- package/dist/src/views/admin/layouts/admin-layout.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/admin-layout.js +5 -9
- package/dist/src/views/admin/layouts/sidebar/nav/item.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/item.js +8 -12
- package/dist/src/views/admin/layouts/sidebar/nav/nav.d.ts +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/nav.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/nav.js +23 -12
- package/dist/src/views/admin/layouts/sidebar/sidebar.d.ts +1 -1
- package/dist/src/views/admin/layouts/sidebar/sidebar.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/sidebar.js +1 -2
- package/dist/src/views/admin/layouts/sidebar/sign-out.js +1 -1
- package/dist/src/views/admin/layouts/user-bar/client.js +5 -5
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts +1 -1
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/user-bar/user-bar.js +1 -1
- package/dist/src/views/admin/sign-in/sign-in-admin-view.js +1 -1
- package/dist/src/views/admin/views/core/advanced/cron/cron-table-view.d.ts +5 -0
- package/dist/src/views/admin/views/core/advanced/cron/cron-table-view.d.ts.map +1 -0
- package/dist/src/views/admin/views/core/advanced/cron/cron-table-view.js +97 -0
- package/dist/src/views/admin/views/core/advanced/cron/run-action/mutation-api.d.ts +4 -0
- package/dist/src/views/admin/views/core/advanced/cron/run-action/mutation-api.d.ts.map +1 -0
- package/dist/src/views/admin/views/core/advanced/cron/run-action/mutation-api.js +23 -0
- package/dist/src/views/admin/views/core/advanced/cron/run-action/run-action.d.ts +4 -0
- package/dist/src/views/admin/views/core/advanced/cron/run-action/run-action.d.ts.map +1 -0
- package/dist/src/views/admin/views/core/advanced/cron/run-action/run-action.js +37 -0
- package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.js +3 -3
- package/dist/src/views/admin/views/core/debug/actions/clear-cache/clear-cache.js +10 -10
- package/dist/src/views/admin/views/core/debug/actions/clear-cache/mutation-api.js +2 -2
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.js +15 -15
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.js +16 -25
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.js +7 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.js +3 -3
- package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.js +25 -25
- package/dist/src/views/admin/views/core/test.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/test.js +134 -124
- package/dist/src/views/admin/views/core/users/users-admin-view.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/users/users-admin-view.js +13 -14
- package/dist/src/views/auth/password-reset/change-password-form/form.js +9 -9
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts +2 -2
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +5 -5
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts +2 -2
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/password-reset/change-password-form/use-form.js +7 -7
- package/dist/src/views/auth/password-reset/form/form.d.ts +2 -2
- package/dist/src/views/auth/password-reset/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/password-reset/form/form.js +15 -15
- package/dist/src/views/auth/password-reset/form/mutation-api.js +5 -5
- package/dist/src/views/auth/password-reset/form/use-form.d.ts +2 -2
- package/dist/src/views/auth/password-reset/form/use-form.js +7 -7
- package/dist/src/views/auth/password-reset/password-reset-view.js +4 -4
- package/dist/src/views/auth/sign-in/form/form.js +9 -9
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts +2 -2
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/mutation-api.js +10 -10
- package/dist/src/views/auth/sign-in/form/use-form.d.ts +2 -2
- package/dist/src/views/auth/sign-in/form/use-form.js +11 -11
- package/dist/src/views/auth/sign-in/sign-in-view.js +5 -5
- package/dist/src/views/auth/sign-up/components/password-input.d.ts +3 -3
- package/dist/src/views/auth/sign-up/components/password-input.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/components/password-input.js +9 -10
- package/dist/src/views/auth/sign-up/email-confirmation-view.js +4 -4
- package/dist/src/views/auth/sign-up/form/form.d.ts +2 -2
- package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/form.js +18 -18
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +2 -2
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/mutation-api.js +6 -6
- package/dist/src/views/auth/sign-up/form/use-form.d.ts +2 -2
- package/dist/src/views/auth/sign-up/form/use-form.js +21 -21
- package/dist/src/views/auth/sign-up/sign-up-view.js +5 -5
- package/dist/src/views/auth/sign-up/wrapper.d.ts +1 -1
- package/dist/src/views/auth/sign-up/wrapper.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/wrapper.js +5 -8
- package/dist/src/views/auth/sso/buttons/client.js +4 -4
- package/dist/src/views/auth/sso/buttons/mutation-api.js +5 -5
- package/dist/src/views/auth/sso/buttons/sso-buttons.js +2 -2
- package/dist/src/views/auth/sso/callback/callback-sso-view.js +6 -6
- package/dist/src/views/auth/sso/callback/client/client.d.ts +1 -1
- package/dist/src/views/auth/sso/callback/client/client.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/client/client.js +9 -9
- package/dist/src/views/auth/sso/callback/client/mutation-api.js +7 -7
- package/dist/src/views/error/back-button.js +1 -1
- package/dist/src/views/error/error-view.js +4 -4
- package/dist/src/views/error/global-error-view.d.ts +3 -3
- package/dist/src/views/error/global-error-view.d.ts.map +1 -1
- package/dist/src/views/error/global-error-view.js +36 -44
- package/dist/src/views/layouts/provider.d.ts +4 -4
- package/dist/src/views/layouts/provider.d.ts.map +1 -1
- package/dist/src/views/layouts/provider.js +3 -3
- package/dist/src/views/layouts/root-layout.d.ts +3 -3
- package/dist/src/views/layouts/root-layout.d.ts.map +1 -1
- package/dist/src/views/layouts/root-layout.js +1 -2
- package/dist/src/views/layouts/theme/header/header.d.ts +2 -2
- package/dist/src/views/layouts/theme/header/header.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/header.js +2 -2
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.js +4 -4
- package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.js +8 -8
- package/dist/src/views/layouts/theme/header/user/user.js +4 -4
- package/dist/src/views/layouts/theme/layout.d.ts +2 -2
- package/dist/src/views/layouts/theme/layout.js +1 -1
- package/dist/src/vitnode.config.d.ts +18 -16
- package/dist/src/vitnode.config.d.ts.map +1 -1
- package/dist/src/vitnode.config.js +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -29
- package/src/app/login/page.tsx +5 -5
- package/src/app/login/reset-password/page.tsx +5 -5
- package/src/app/login/sso/[providerId]/page.tsx +1 -1
- package/src/app/register/page.tsx +5 -5
- package/src/app_admin/core/advanced/cron/page.tsx +41 -0
- package/src/app_admin/core/debug/page.tsx +14 -14
- package/src/app_admin/core/page.tsx +1 -1
- package/src/app_admin/core/test/page.tsx +1 -1
- package/src/app_admin/core/users/page.tsx +12 -13
- package/src/locales/en.json +43 -0
- package/src/tiptap.css +20 -0
- package/dist/src/components/switchers/langs/language-swietcher.d.ts.map +0 -1
|
@@ -2,7 +2,7 @@ import { HTTPException } from "hono/http-exception";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { getRedirectUri } from "../../models/sso.js";
|
|
4
4
|
export const FacebookSSOApiPlugin = ({ clientId, clientSecret })=>{
|
|
5
|
-
const id =
|
|
5
|
+
const id = "facebook";
|
|
6
6
|
const redirectUri = getRedirectUri(id);
|
|
7
7
|
const tokenSchema = z.object({
|
|
8
8
|
access_token: z.string(),
|
|
@@ -15,44 +15,44 @@ export const FacebookSSOApiPlugin = ({ clientId, clientSecret })=>{
|
|
|
15
15
|
});
|
|
16
16
|
return {
|
|
17
17
|
id,
|
|
18
|
-
name:
|
|
18
|
+
name: "Facebook",
|
|
19
19
|
fetchToken: async (code)=>{
|
|
20
|
-
if (!clientId
|
|
21
|
-
throw new Error(
|
|
20
|
+
if (!(clientId && clientSecret)) {
|
|
21
|
+
throw new Error("Missing Facebook client ID or secret");
|
|
22
22
|
}
|
|
23
|
-
const url = new URL(
|
|
24
|
-
url.searchParams.set(
|
|
25
|
-
url.searchParams.set(
|
|
26
|
-
url.searchParams.set(
|
|
27
|
-
url.searchParams.set(
|
|
23
|
+
const url = new URL("https://graph.facebook.com/v22.0/oauth/access_token");
|
|
24
|
+
url.searchParams.set("code", code);
|
|
25
|
+
url.searchParams.set("redirect_uri", redirectUri);
|
|
26
|
+
url.searchParams.set("client_id", clientId);
|
|
27
|
+
url.searchParams.set("client_secret", clientSecret);
|
|
28
28
|
const res = await fetch(url.toString());
|
|
29
29
|
if (!res.ok) {
|
|
30
30
|
throw new HTTPException(+res.status.toString(), {
|
|
31
|
-
message:
|
|
31
|
+
message: "Internal error requesting token"
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
const { data, error } = tokenSchema.safeParse(await res.json());
|
|
35
35
|
if (error || !data) {
|
|
36
36
|
throw new HTTPException(400, {
|
|
37
|
-
message:
|
|
37
|
+
message: "Invalid token response"
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
return data;
|
|
41
41
|
},
|
|
42
42
|
fetchUser: async ({ access_token })=>{
|
|
43
|
-
const url = new URL(
|
|
44
|
-
url.searchParams.set(
|
|
45
|
-
url.searchParams.set(
|
|
43
|
+
const url = new URL("https://graph.facebook.com/v22.0/me");
|
|
44
|
+
url.searchParams.set("fields", "id,name,email");
|
|
45
|
+
url.searchParams.set("access_token", access_token);
|
|
46
46
|
const res = await fetch(url.toString());
|
|
47
47
|
if (!res.ok) {
|
|
48
48
|
throw new HTTPException(+res.status.toString(), {
|
|
49
|
-
message:
|
|
49
|
+
message: "Internal error requesting user"
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
const { data: userData, error: userError } = userSchema.safeParse(await res.json());
|
|
53
53
|
if (userError || !userData) {
|
|
54
54
|
throw new HTTPException(400, {
|
|
55
|
-
message:
|
|
55
|
+
message: "Invalid user response"
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
return {
|
|
@@ -62,14 +62,14 @@ export const FacebookSSOApiPlugin = ({ clientId, clientSecret })=>{
|
|
|
62
62
|
},
|
|
63
63
|
getUrl: ({ state })=>{
|
|
64
64
|
if (!clientId) {
|
|
65
|
-
throw new Error(
|
|
65
|
+
throw new Error("Missing Facebook client ID");
|
|
66
66
|
}
|
|
67
|
-
const url = new URL(
|
|
68
|
-
url.searchParams.set(
|
|
69
|
-
url.searchParams.set(
|
|
70
|
-
url.searchParams.set(
|
|
71
|
-
url.searchParams.set(
|
|
72
|
-
url.searchParams.set(
|
|
67
|
+
const url = new URL("https://www.facebook.com/v22.0/dialog/oauth");
|
|
68
|
+
url.searchParams.set("client_id", clientId);
|
|
69
|
+
url.searchParams.set("redirect_uri", redirectUri);
|
|
70
|
+
url.searchParams.set("scope", "public_profile,email");
|
|
71
|
+
url.searchParams.set("response_type", "code");
|
|
72
|
+
url.searchParams.set("state", state);
|
|
73
73
|
return url.toString();
|
|
74
74
|
}
|
|
75
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../../../src/api/adapters/sso/google.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../../../src/api/adapters/sso/google.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,eAAO,MAAM,kBAAkB,GAAI,6BAGhC;IACD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,KAAG,YA+FH,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { HTTPException } from "hono/http-exception";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { getRedirectUri } from "../../models/sso.js";
|
|
4
4
|
export const GoogleSSOApiPlugin = ({ clientId, clientSecret })=>{
|
|
5
|
-
const id =
|
|
5
|
+
const id = "google";
|
|
6
6
|
const redirectUri = getRedirectUri(id);
|
|
7
7
|
const tokenSchema = z.object({
|
|
8
8
|
access_token: z.string(),
|
|
@@ -16,40 +16,40 @@ export const GoogleSSOApiPlugin = ({ clientId, clientSecret })=>{
|
|
|
16
16
|
});
|
|
17
17
|
return {
|
|
18
18
|
id,
|
|
19
|
-
name:
|
|
19
|
+
name: "Google",
|
|
20
20
|
fetchToken: async (code)=>{
|
|
21
|
-
if (!clientId
|
|
22
|
-
throw new Error(
|
|
21
|
+
if (!(clientId && clientSecret)) {
|
|
22
|
+
throw new Error("Missing Google client ID or secret");
|
|
23
23
|
}
|
|
24
|
-
const res = await fetch(
|
|
25
|
-
method:
|
|
24
|
+
const res = await fetch("https://oauth2.googleapis.com/token", {
|
|
25
|
+
method: "POST",
|
|
26
26
|
headers: {
|
|
27
|
-
|
|
28
|
-
Accept:
|
|
27
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
28
|
+
Accept: "application/json"
|
|
29
29
|
},
|
|
30
30
|
body: new URLSearchParams({
|
|
31
31
|
code,
|
|
32
32
|
redirect_uri: redirectUri,
|
|
33
|
-
grant_type:
|
|
33
|
+
grant_type: "authorization_code",
|
|
34
34
|
client_id: clientId,
|
|
35
35
|
client_secret: clientSecret
|
|
36
36
|
})
|
|
37
37
|
});
|
|
38
38
|
if (!res.ok) {
|
|
39
39
|
throw new HTTPException(+res.status.toString(), {
|
|
40
|
-
message:
|
|
40
|
+
message: "Internal error requesting token"
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
const { data, error } = tokenSchema.safeParse(await res.json());
|
|
44
44
|
if (error || !data) {
|
|
45
45
|
throw new HTTPException(400, {
|
|
46
|
-
message:
|
|
46
|
+
message: "Invalid token response"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
return data;
|
|
50
50
|
},
|
|
51
51
|
fetchUser: async ({ token_type, access_token })=>{
|
|
52
|
-
const res = await fetch(
|
|
52
|
+
const res = await fetch("https://www.googleapis.com/oauth2/v1/userinfo", {
|
|
53
53
|
headers: {
|
|
54
54
|
Authorization: `${token_type} ${access_token}`
|
|
55
55
|
}
|
|
@@ -58,12 +58,12 @@ export const GoogleSSOApiPlugin = ({ clientId, clientSecret })=>{
|
|
|
58
58
|
const { data, error } = userSchema.safeParse(dataFromRes);
|
|
59
59
|
if (error || !data) {
|
|
60
60
|
throw new HTTPException(400, {
|
|
61
|
-
message:
|
|
61
|
+
message: "Invalid user response"
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
if (!data.verified_email) {
|
|
65
65
|
throw new HTTPException(400, {
|
|
66
|
-
message:
|
|
66
|
+
message: "Email not verified"
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
return {
|
|
@@ -73,14 +73,14 @@ export const GoogleSSOApiPlugin = ({ clientId, clientSecret })=>{
|
|
|
73
73
|
},
|
|
74
74
|
getUrl: ({ state })=>{
|
|
75
75
|
if (!clientId) {
|
|
76
|
-
throw new Error(
|
|
76
|
+
throw new Error("Missing Google client ID");
|
|
77
77
|
}
|
|
78
|
-
const url = new URL(
|
|
79
|
-
url.searchParams.set(
|
|
80
|
-
url.searchParams.set(
|
|
81
|
-
url.searchParams.set(
|
|
82
|
-
url.searchParams.set(
|
|
83
|
-
url.searchParams.set(
|
|
78
|
+
const url = new URL("https://accounts.google.com/o/oauth2/auth");
|
|
79
|
+
url.searchParams.set("client_id", clientId);
|
|
80
|
+
url.searchParams.set("redirect_uri", redirectUri);
|
|
81
|
+
url.searchParams.set("response_type", "code");
|
|
82
|
+
url.searchParams.set("scope", "openid profile email");
|
|
83
|
+
url.searchParams.set("state", state);
|
|
84
84
|
return url.toString();
|
|
85
85
|
}
|
|
86
86
|
};
|
package/dist/src/api/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OpenAPIHono } from
|
|
2
|
-
import type { Context, Env, Schema } from
|
|
3
|
-
import type { VitNodeApiConfig } from
|
|
1
|
+
import type { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
+
import type { Context, Env, Schema } from "hono";
|
|
3
|
+
import type { VitNodeApiConfig } from "../vitnode.config";
|
|
4
4
|
interface CORSOptions {
|
|
5
5
|
allowHeaders?: string[];
|
|
6
6
|
allowMethods?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/api/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/api/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAOjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOzD,UAAU,WAAW;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EACF,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC,GAC3D,MAAM,GACN,MAAM,EAAE,CAAC;CACd;AAED,KAAK,sBAAsB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;AAC5E,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,sBAAsB,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;CACrD;AAED,wBAAgB,UAAU,CAAC,EACzB,GAAG,EACH,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,WAAW,EACjB,gBAAgB,GACjB,EAAE;IACD,GAAG,EAAE,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,oCAiEA"}
|
package/dist/src/api/config.js
CHANGED
|
@@ -7,48 +7,60 @@ import { CONFIG_PLUGIN } from "../config.js";
|
|
|
7
7
|
import { globalAdminMiddleware, globalMiddleware } from "./middlewares/global.middleware.js";
|
|
8
8
|
import { rateLimiterMiddleware } from "./middlewares/rate-limiter.middleware.js";
|
|
9
9
|
export function VitNodeAPI({ app, cors: corsOptions, csrf: csrfOptions, vitNodeApiConfig }) {
|
|
10
|
-
app.doc(
|
|
11
|
-
openapi:
|
|
10
|
+
app.doc("/swagger/doc", {
|
|
11
|
+
openapi: "3.0.0",
|
|
12
12
|
info: {
|
|
13
13
|
version: CONFIG_PLUGIN.version,
|
|
14
|
-
title:
|
|
14
|
+
title: "VitNode API"
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
app.use(cors(corsOptions));
|
|
18
18
|
app.use(csrf(csrfOptions));
|
|
19
|
-
app.use(
|
|
20
|
-
app.get(
|
|
21
|
-
url:
|
|
19
|
+
app.use("*", rateLimiterMiddleware(vitNodeApiConfig.rateLimiter));
|
|
20
|
+
app.get("/swagger", swaggerUI({
|
|
21
|
+
url: "/api/swagger/doc"
|
|
22
22
|
}));
|
|
23
|
-
app.use(
|
|
23
|
+
app.use("*", globalMiddleware({
|
|
24
24
|
pathToMessages: vitNodeApiConfig.pathToMessages,
|
|
25
25
|
email: vitNodeApiConfig.email,
|
|
26
26
|
metadata: vitNodeApiConfig.metadata,
|
|
27
27
|
authorization: vitNodeApiConfig.authorization,
|
|
28
28
|
dbProvider: vitNodeApiConfig.dbProvider,
|
|
29
29
|
captcha: vitNodeApiConfig.captcha,
|
|
30
|
-
plugins:
|
|
30
|
+
plugins: [
|
|
31
|
+
newBuildPluginApiCore,
|
|
32
|
+
...vitNodeApiConfig.plugins
|
|
33
|
+
]
|
|
31
34
|
}));
|
|
32
35
|
app.use(async (c, next)=>{
|
|
33
|
-
if (c.req.path.includes(
|
|
34
|
-
return globalAdminMiddleware()(c, next);
|
|
36
|
+
if (c.req.path.includes("/admin/")) {
|
|
37
|
+
return await globalAdminMiddleware()(c, next);
|
|
35
38
|
}
|
|
36
39
|
return next();
|
|
37
40
|
});
|
|
41
|
+
if (vitNodeApiConfig.cronAdapter) {
|
|
42
|
+
vitNodeApiConfig.cronAdapter.schedule();
|
|
43
|
+
}
|
|
44
|
+
[
|
|
45
|
+
newBuildPluginApiCore,
|
|
46
|
+
...vitNodeApiConfig.plugins
|
|
47
|
+
].map((root)=>{
|
|
48
|
+
app.route(`/${root.pluginId}`, root.hono);
|
|
49
|
+
});
|
|
38
50
|
app.onError(async (error, c)=>{
|
|
39
51
|
if (error instanceof HTTPException) {
|
|
40
52
|
return error.getResponse();
|
|
41
53
|
}
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
const errorMessage = error?.message ?? "Unknown error";
|
|
55
|
+
try {
|
|
56
|
+
const logger = c.get("log");
|
|
57
|
+
if (logger) {
|
|
58
|
+
await logger.error(`Unhandled error: ${errorMessage}`);
|
|
59
|
+
}
|
|
60
|
+
} catch {}
|
|
61
|
+
return new Response(process.env.NODE_ENV === "development" ? errorMessage : "Internal Server Error", {
|
|
44
62
|
status: 500
|
|
45
63
|
});
|
|
46
64
|
});
|
|
47
|
-
[
|
|
48
|
-
newBuildPluginApiCore,
|
|
49
|
-
...vitNodeApiConfig.plugins
|
|
50
|
-
].map((root)=>{
|
|
51
|
-
app.route(`/${root.pluginId}`, root.hono);
|
|
52
|
-
});
|
|
53
65
|
return app;
|
|
54
66
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "fs";
|
|
2
|
-
import { join, resolve } from "path";
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import { CONFIG } from "../../lib/config.js";
|
|
4
4
|
export const checkPluginId = (pluginName)=>{
|
|
5
5
|
if (!CONFIG.node_development) return null;
|
|
6
6
|
const findMonorepoRoot = (startPath)=>{
|
|
7
7
|
let currentPath = startPath;
|
|
8
|
-
while(currentPath !== resolve(currentPath,
|
|
9
|
-
const turboConfigPath = join(currentPath,
|
|
8
|
+
while(currentPath !== resolve(currentPath, "..")){
|
|
9
|
+
const turboConfigPath = join(currentPath, "turbo.json");
|
|
10
10
|
if (existsSync(turboConfigPath)) {
|
|
11
11
|
return currentPath;
|
|
12
12
|
}
|
|
13
|
-
currentPath = resolve(currentPath,
|
|
13
|
+
currentPath = resolve(currentPath, "..");
|
|
14
14
|
}
|
|
15
15
|
return null;
|
|
16
16
|
};
|
|
@@ -18,13 +18,13 @@ export const checkPluginId = (pluginName)=>{
|
|
|
18
18
|
const cwd = process.cwd();
|
|
19
19
|
const monorepoRoot = findMonorepoRoot(cwd);
|
|
20
20
|
// Check in current working directory first
|
|
21
|
-
const cwdPluginPath = join(cwd,
|
|
21
|
+
const cwdPluginPath = join(cwd, "node_modules", pluginName, "package.json");
|
|
22
22
|
if (existsSync(cwdPluginPath)) {
|
|
23
23
|
return cwdPluginPath;
|
|
24
24
|
}
|
|
25
25
|
// Check in monorepo root if it exists and is different from cwd
|
|
26
26
|
if (monorepoRoot && monorepoRoot !== cwd) {
|
|
27
|
-
const rootPluginPath = join(monorepoRoot,
|
|
27
|
+
const rootPluginPath = join(monorepoRoot, "node_modules", pluginName, "package.json");
|
|
28
28
|
if (existsSync(rootPluginPath)) {
|
|
29
29
|
return rootPluginPath;
|
|
30
30
|
}
|
|
@@ -35,7 +35,7 @@ export const checkPluginId = (pluginName)=>{
|
|
|
35
35
|
if (!path) {
|
|
36
36
|
throw new Error(`package.json file not found for plugin "${pluginName}". Please ensure you are using the correct plugin name as specified in its package.json.`);
|
|
37
37
|
}
|
|
38
|
-
const content = JSON.parse(readFileSync(path,
|
|
38
|
+
const content = JSON.parse(readFileSync(path, "utf-8"));
|
|
39
39
|
if (content.name !== pluginName) {
|
|
40
40
|
throw new Error(`The plugin name in package.json (${content.name}) does not match the requested plugin name (${pluginName}). Please check the plugin name.`);
|
|
41
41
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import type { EnvVitNode } from "../middlewares/global.middleware";
|
|
3
|
+
export interface CronAdapter {
|
|
4
|
+
schedule(): void;
|
|
5
|
+
}
|
|
6
|
+
export interface BuildCronReturn {
|
|
7
|
+
name: string;
|
|
8
|
+
schedule: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
handler: (c: Context<EnvVitNode>) => void | Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface CronJobConfig extends BuildCronReturn {
|
|
13
|
+
pluginId: string;
|
|
14
|
+
module: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildCron({ name, schedule, handler, description, }: BuildCronReturn): BuildCronReturn;
|
|
17
|
+
export declare const handleCronJobs: () => Promise<void>;
|
|
18
|
+
//# sourceMappingURL=cron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/cron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,WAAW,WAAW;IAC1B,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D;AAED,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,WAAW,GACZ,EAAE,eAAe,GAAG,eAAe,CAEnC;AAED,eAAO,MAAM,cAAc,qBAc1B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CONFIG } from "../../lib/config.js";
|
|
2
|
+
export function buildCron({ name, schedule, handler, description }) {
|
|
3
|
+
return {
|
|
4
|
+
name,
|
|
5
|
+
schedule,
|
|
6
|
+
handler,
|
|
7
|
+
description
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export const handleCronJobs = async ()=>{
|
|
11
|
+
const url = new URL("/api/@vitnode/core/cron", CONFIG.api.origin);
|
|
12
|
+
const headers = {
|
|
13
|
+
"Content-Type": "application/json"
|
|
14
|
+
};
|
|
15
|
+
if (CONFIG.cronJobSecret) {
|
|
16
|
+
headers.authorization = `Bearer ${CONFIG.cronJobSecret}`;
|
|
17
|
+
}
|
|
18
|
+
await fetch(url.toString(), {
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noConsole: <no need> */ import { core_logs } from "../../database/logs.js";
|
|
2
2
|
export const loggerMiddleware = (c)=>{
|
|
3
3
|
const logToDbAndConsole = async (content, type)=>{
|
|
4
|
-
const pluginId = c.get(
|
|
5
|
-
const ipAddress = c.get(
|
|
6
|
-
await c.get(
|
|
4
|
+
const pluginId = c.get("plugin")?.id ?? "core";
|
|
5
|
+
const ipAddress = c.get("ipAddress");
|
|
6
|
+
await c.get("db").insert(core_logs).values({
|
|
7
7
|
pluginId,
|
|
8
8
|
type,
|
|
9
9
|
content,
|
|
10
10
|
ipAddress,
|
|
11
11
|
method: c.req.method.toUpperCase(),
|
|
12
12
|
path: c.req.path,
|
|
13
|
-
userAgent: c.req.header(
|
|
13
|
+
userAgent: c.req.header("User-Agent"),
|
|
14
14
|
statusCode: c.res.status,
|
|
15
|
-
userId: c.get(
|
|
15
|
+
userId: c.get("user")?.id
|
|
16
16
|
});
|
|
17
17
|
const loggers = {
|
|
18
18
|
debug: (msg)=>console.debug(`\x1b[34m[VitNode]\x1b[0m \x1b[38;5;208mDebug (${pluginId})\x1b[0m: ${msg}`),
|
|
@@ -23,13 +23,13 @@ export const loggerMiddleware = (c)=>{
|
|
|
23
23
|
};
|
|
24
24
|
return {
|
|
25
25
|
debug: async (content)=>{
|
|
26
|
-
await logToDbAndConsole(content,
|
|
26
|
+
await logToDbAndConsole(content, "debug");
|
|
27
27
|
},
|
|
28
28
|
error: async (content)=>{
|
|
29
|
-
await logToDbAndConsole(content,
|
|
29
|
+
await logToDbAndConsole(content, "error");
|
|
30
30
|
},
|
|
31
31
|
warn: async (content)=>{
|
|
32
|
-
await logToDbAndConsole(content,
|
|
32
|
+
await logToDbAndConsole(content, "warn");
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { OpenAPIHono } from
|
|
2
|
-
import type {
|
|
1
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
+
import type { BuildCronReturn } from "./cron";
|
|
3
|
+
import type { Route } from "./route";
|
|
3
4
|
export interface BuildModuleType<T extends Route, Plugin extends string> {
|
|
4
5
|
plugin: Plugin;
|
|
5
6
|
routes: T;
|
|
@@ -10,14 +11,16 @@ export interface BaseBuildModuleReturn<P extends string = string, M extends stri
|
|
|
10
11
|
name: M;
|
|
11
12
|
pluginId: P;
|
|
12
13
|
routes: Routes;
|
|
14
|
+
cronJobs: BuildCronReturn[];
|
|
13
15
|
}
|
|
14
16
|
export interface BuildModuleReturn<P extends string, M extends string, Routes extends Route<P>[] = Route<P>[], Modules extends BaseBuildModuleReturn<P>[] = BaseBuildModuleReturn<P>[]> extends BaseBuildModuleReturn<P, M, Routes> {
|
|
15
17
|
modules?: Modules;
|
|
16
18
|
}
|
|
17
|
-
export declare function buildModule<const P extends string, const M extends string, const Routes extends Route<P>[], Modules extends BaseBuildModuleReturn<P>[]>({ routes, pluginId, name, modules, }: {
|
|
19
|
+
export declare function buildModule<const P extends string, const M extends string, const Routes extends Route<P>[], Modules extends BaseBuildModuleReturn<P>[]>({ routes, pluginId, name, modules, cronJobs, }: {
|
|
18
20
|
modules?: Modules;
|
|
19
21
|
name: M;
|
|
20
22
|
pluginId: P;
|
|
21
23
|
routes: Routes;
|
|
24
|
+
cronJobs?: BuildCronReturn[];
|
|
22
25
|
}): BuildModuleReturn<P, M, Routes, Modules>;
|
|
23
26
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,KAAK,EAAE,MAAM,SAAS,MAAM;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,CAAC,CAAC;CACX;AAED,MAAM,WAAW,qBAAqB,CACpC,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,MAAM,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;IAEtC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,CAAC,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB,CAChC,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,EAChB,MAAM,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,EACtC,OAAO,SAAS,qBAAqB,CAAC,CAAC,CAAC,EAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,CACvE,SAAQ,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,WAAW,CACzB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,MAAM,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,EAC/B,OAAO,SAAS,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAC1C,EACA,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAa,GACd,EAAE;IACD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,CAAC,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B,GAAG,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAgB3C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
export function buildModule({ routes, pluginId, name, modules }) {
|
|
2
|
+
export function buildModule({ routes, pluginId, name, modules, cronJobs = [] }) {
|
|
3
3
|
const hono = new OpenAPIHono();
|
|
4
4
|
if (routes) {
|
|
5
5
|
routes.forEach(({ handler, route })=>{
|
|
@@ -16,6 +16,7 @@ export function buildModule({ routes, pluginId, name, modules }) {
|
|
|
16
16
|
pluginId,
|
|
17
17
|
hono,
|
|
18
18
|
name,
|
|
19
|
-
modules
|
|
19
|
+
modules,
|
|
20
|
+
cronJobs
|
|
20
21
|
};
|
|
21
22
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { OpenAPIHono } from
|
|
2
|
-
import type {
|
|
1
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
+
import type { CronJobConfig } from "./cron";
|
|
3
|
+
import type { BuildModuleReturn } from "./module";
|
|
3
4
|
export interface BuildPluginApiReturn {
|
|
4
5
|
hono: OpenAPIHono;
|
|
5
6
|
pluginId: string;
|
|
7
|
+
cronJobs: Omit<CronJobConfig, "pluginId">[];
|
|
6
8
|
}
|
|
7
9
|
export declare function buildApiPlugin<P extends string>({ pluginId, modules, }: {
|
|
8
10
|
modules?: BuildModuleReturn<P, string>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC;CAC7C;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,EAC/C,QAAQ,EACR,OAAY,GACb,EAAE;IACD,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;IACzC,QAAQ,EAAE,CAAC,CAAC;CACb,GAAG,oBAAoB,CAmBvB"}
|
|
@@ -4,11 +4,19 @@ export function buildApiPlugin({ pluginId, modules = [] }) {
|
|
|
4
4
|
// Run for checking if the plugin is valid
|
|
5
5
|
checkPluginId(pluginId);
|
|
6
6
|
const hono = new OpenAPIHono();
|
|
7
|
+
const cronJobs = [];
|
|
7
8
|
modules.forEach((handler)=>{
|
|
8
9
|
hono.route(`/${handler.name}`, handler.hono);
|
|
10
|
+
handler.cronJobs?.forEach((cron)=>{
|
|
11
|
+
cronJobs.push({
|
|
12
|
+
...cron,
|
|
13
|
+
module: handler.name
|
|
14
|
+
});
|
|
15
|
+
});
|
|
9
16
|
});
|
|
10
17
|
return {
|
|
11
18
|
pluginId,
|
|
12
|
-
hono
|
|
19
|
+
hono,
|
|
20
|
+
cronJobs
|
|
13
21
|
};
|
|
14
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RouteConfig, RouteHandler } from
|
|
2
|
-
import { type EnvVitNode } from
|
|
1
|
+
import type { RouteConfig, RouteHandler } from "@hono/zod-openapi";
|
|
2
|
+
import { type EnvVitNode } from "../middlewares/global.middleware";
|
|
3
3
|
type RoutingPath<P extends string> = P extends `${infer Head}/{${infer Param}}${infer Tail}` ? `${Head}/:${Param}${RoutingPath<Tail>}` : P;
|
|
4
4
|
type ValidHandler<R extends RouteConfig> = (c: Parameters<RouteHandler<R, EnvVitNode>>[0]) => ReturnType<RouteHandler<R>>;
|
|
5
5
|
export declare const buildRoute: <Plugin extends string, P extends string, R extends Omit<RouteConfig, "path"> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKnE,OAAO,EACL,KAAK,UAAU,EAEhB,MAAM,kCAAkC,CAAC;AAE1C,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,IAC/B,CAAC,SAAS,GAAG,MAAM,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,GACnD,GAAG,IAAI,KAAK,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,GACvC,CAAC,CAAC;AAER,KAAK,YAAY,CAAC,CAAC,SAAS,WAAW,IAAI,CACzC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAC1C,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjC,eAAO,MAAM,UAAU,GACrB,MAAM,SAAS,MAAM,EACrB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IACpC,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,EACD,CAAC,SAAS,YAAY,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,EACvC,+BAIC;IACD,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV,KAAG;IACF,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,GAAG;QACT,cAAc,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;KAC9C,CAAC;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKnE,OAAO,EACL,KAAK,UAAU,EAEhB,MAAM,kCAAkC,CAAC;AAE1C,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,IAC/B,CAAC,SAAS,GAAG,MAAM,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,GACnD,GAAG,IAAI,KAAK,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,GACvC,CAAC,CAAC;AAER,KAAK,YAAY,CAAC,CAAC,SAAS,WAAW,IAAI,CACzC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAC1C,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjC,eAAO,MAAM,UAAU,GACrB,MAAM,SAAS,MAAM,EACrB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IACpC,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,EACD,CAAC,SAAS,YAAY,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,EACvC,+BAIC;IACD,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV,KAAG;IACF,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,GAAG;QACT,cAAc,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;KAC9C,CAAC;CA6BH,CAAC;AAEF,MAAM,WAAW,KAAK,CACpB,MAAM,SAAS,MAAM,GAAG,MAAM,EAC9B,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAE3C,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV"}
|
|
@@ -2,7 +2,7 @@ import { createRoute as createRouteHono } from "@hono/zod-openapi";
|
|
|
2
2
|
import { captchaMiddleware } from "../middlewares/captcha.middleware.js";
|
|
3
3
|
import { pluginMiddleware } from "../middlewares/global.middleware.js";
|
|
4
4
|
export const buildRoute = ({ route, handler, pluginId })=>{
|
|
5
|
-
const pluginTag = pluginId.split(/[-_]/).map((word)=>word.charAt(0).toUpperCase() + word.slice(1)).join(
|
|
5
|
+
const pluginTag = pluginId.split(/[-_]/).map((word)=>word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
6
6
|
const tags = [
|
|
7
7
|
pluginTag,
|
|
8
8
|
...route.tags ?? []
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
export declare function withPagination<QueryMin extends Record<string, unknown>, T extends TableConfig, Primary extends ColumnBaseConfig<
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import type { ColumnBaseConfig, Placeholder, SQL } from "drizzle-orm";
|
|
3
|
+
import type { PgColumn, PgTableWithColumns, TableConfig } from "drizzle-orm/pg-core";
|
|
4
|
+
import type { Context } from "hono";
|
|
5
|
+
export declare function withPagination<QueryMin extends Record<string, unknown>, T extends TableConfig, Primary extends ColumnBaseConfig<"number", string>>({ query, table, params, where: whereFromParams, primaryCursor, orderBy: orderByFromParams, c, }: {
|
|
6
6
|
c: Context;
|
|
7
7
|
orderBy: {
|
|
8
8
|
column: PgColumn;
|
|
9
|
-
order:
|
|
9
|
+
order: "asc" | "desc";
|
|
10
10
|
};
|
|
11
11
|
params: {
|
|
12
12
|
query: {
|
|
@@ -21,7 +21,7 @@ export declare function withPagination<QueryMin extends Record<string, unknown>,
|
|
|
21
21
|
orderBy: SQL;
|
|
22
22
|
where: SQL | undefined;
|
|
23
23
|
}) => Promise<QueryMin[]>;
|
|
24
|
-
table: Omit<PgTableWithColumns<T>,
|
|
24
|
+
table: Omit<PgTableWithColumns<T>, "enableRLS">;
|
|
25
25
|
where?: SQL;
|
|
26
26
|
}): Promise<{
|
|
27
27
|
edges: QueryMin[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-pagination.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/with-pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"with-pagination.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/with-pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,KAAK,EACV,QAAQ,EAER,kBAAkB,EAClB,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAwEpC,wBAAsB,cAAc,CAClC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,CAAC,SAAS,WAAW,EACrB,OAAO,SAAS,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,EAClD,EACA,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,EAAE,eAAe,EACtB,aAAa,EACb,OAAO,EAAE,iBAAiB,EAC1B,CAAC,GACF,EAAE;IACD,CAAC,EAAE,OAAO,CAAC;IACX,OAAO,EAAE;QACP,MAAM,EAAE,QAAQ,CAAC;QACjB,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,MAAM,EAAE;QACN,KAAK,EAAE;YACL,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,KAAK,EAAE,CAAC,IAAI,EAAE;QACZ,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,EAAE,GAAG,CAAC;QACb,KAAK,EAAE,GAAG,GAAG,SAAS,CAAC;KACxB,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1B,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,GAAG,OAAO,CAAC;IACV,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;QACzB,WAAW,EAAE,OAAO,CAAC;QACrB,eAAe,EAAE,OAAO,CAAC;QACzB,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC,CA8CD;AAED,eAAO,MAAM,qBAAqB;;;;;;;iBAOhC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;iBAI7B,CAAC"}
|