@vitnode/core 1.2.0-canary.53 → 1.2.0-canary.55
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/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 +4 -4
- 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/sso/discord.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/facebook.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/google.d.ts.map +1 -1
- package/dist/src/api/config.d.ts.map +1 -1
- package/dist/src/api/config.js +22 -9
- 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.js +1 -1
- package/dist/src/api/lib/module.d.ts +4 -1
- 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 +2 -0
- 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.map +1 -1
- package/dist/src/api/lib/with-pagination.d.ts +1 -1
- package/dist/src/api/lib/with-pagination.d.ts.map +1 -1
- 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 +8 -2
- package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/global.middleware.js +33 -23
- package/dist/src/api/models/device.d.ts.map +1 -1
- package/dist/src/api/models/device.js +1 -1
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +1 -2
- package/dist/src/api/models/session-admin.d.ts.map +1 -1
- package/dist/src/api/models/session.d.ts.map +1 -1
- package/dist/src/api/models/sso.d.ts.map +1 -1
- package/dist/src/api/models/sso.js +1 -1
- package/dist/src/api/models/user/get-user-by-id.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-up.d.ts +1 -1
- package/dist/src/api/models/user/sign-up.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-up.js +1 -0
- 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 +163 -1
- package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -1
- package/dist/src/api/modules/admin/admin.module.js +6 -3
- 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.js +1 -1
- package/dist/src/api/modules/admin/debug/routes/logs.route.js +1 -1
- package/dist/src/api/modules/admin/routes/session.route.js +1 -1
- package/dist/src/api/modules/admin/users/routes/list.route.js +1 -1
- package/dist/src/api/modules/admin/users/routes/users.route.d.ts +3 -3
- package/dist/src/api/modules/admin/users/routes/users.route.js +1 -1
- package/dist/src/api/modules/admin/users/users.admin.module.js +1 -1
- 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.js +1 -1
- package/dist/src/api/modules/middleware/route.js +1 -1
- package/dist/src/api/modules/users/routes/change-password.route.js +1 -1
- package/dist/src/api/modules/users/routes/reset-passowrd.route.js +1 -1
- package/dist/src/api/modules/users/routes/session.route.js +1 -1
- package/dist/src/api/modules/users/routes/sign-in.route.js +1 -1
- package/dist/src/api/modules/users/routes/sign-out.route.js +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.js +1 -1
- package/dist/src/api/modules/users/routes/test.route.js +1 -1
- package/dist/src/api/modules/users/sso/routes/callback.route.js +1 -1
- package/dist/src/api/modules/users/sso/routes/create-url.route.js +1 -1
- package/dist/src/api/modules/users/sso/sso.module.js +1 -1
- package/dist/src/api/modules/users/users.module.js +1 -1
- package/dist/src/api/plugin.d.ts.map +1 -1
- package/dist/src/api/plugin.js +4 -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.js +1 -1
- package/dist/src/app_admin/core/users/page.d.ts.map +1 -1
- package/dist/src/app_admin/core/users/page.js +1 -1
- package/dist/src/components/confirm-action/confirm-action-alert-dialog.js +1 -1
- package/dist/src/components/confirm-action/content.d.ts.map +1 -1
- package/dist/src/components/confirm-action/content.js +1 -0
- package/dist/src/components/form/auto-form.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.js +0 -1
- package/dist/src/components/form/fields/checkbox.d.ts +1 -1
- package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/input.d.ts +1 -1
- package/dist/src/components/form/fields/input.d.ts.map +1 -1
- package/dist/src/components/form/fields/select.d.ts.map +1 -1
- package/dist/src/components/form/fields/switch.js +1 -1
- package/dist/src/components/switchers/langs/{language-swietcher.d.ts → language-switcher.d.ts} +1 -1
- package/dist/src/components/switchers/langs/language-switcher.d.ts.map +1 -0
- package/dist/src/components/table/content.d.ts.map +1 -1
- package/dist/src/components/table/data-table.d.ts +1 -1
- package/dist/src/components/table/data-table.d.ts.map +1 -1
- package/dist/src/components/table/order-table-head.d.ts.map +1 -1
- package/dist/src/components/table/pagination.js +1 -1
- 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 +33 -0
- package/dist/src/components/tiptap/toolbar/actions/alignment-action.d.ts +2 -0
- package/dist/src/components/tiptap/toolbar/actions/alignment-action.d.ts.map +1 -0
- package/dist/src/components/tiptap/toolbar/actions/alignment-action.js +91 -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 +93 -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 +61 -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 +55 -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 +1 -1
- package/dist/src/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/components/ui/alert.d.ts +1 -1
- package/dist/src/components/ui/alert.d.ts.map +1 -1
- package/dist/src/components/ui/badge.d.ts +1 -1
- package/dist/src/components/ui/badge.d.ts.map +1 -1
- package/dist/src/components/ui/button-client.d.ts.map +1 -1
- package/dist/src/components/ui/button-client.js +1 -1
- package/dist/src/components/ui/button.d.ts +2 -2
- package/dist/src/components/ui/button.d.ts.map +1 -1
- package/dist/src/components/ui/button.js +1 -1
- package/dist/src/components/ui/checkbox.d.ts +1 -1
- package/dist/src/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/components/ui/command.d.ts +1 -1
- package/dist/src/components/ui/command.d.ts.map +1 -1
- package/dist/src/components/ui/context-menu.d.ts +1 -1
- package/dist/src/components/ui/context-menu.d.ts.map +1 -1
- package/dist/src/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/src/components/ui/dropdown-menu.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/src/components/ui/hover-card.d.ts +1 -1
- package/dist/src/components/ui/hover-card.d.ts.map +1 -1
- package/dist/src/components/ui/label.d.ts +1 -1
- package/dist/src/components/ui/label.d.ts.map +1 -1
- package/dist/src/components/ui/menubar.d.ts +1 -1
- package/dist/src/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/components/ui/navigation-menu.d.ts +1 -1
- package/dist/src/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/src/components/ui/popover.d.ts +1 -1
- package/dist/src/components/ui/popover.d.ts.map +1 -1
- package/dist/src/components/ui/progress.d.ts +1 -1
- package/dist/src/components/ui/progress.d.ts.map +1 -1
- package/dist/src/components/ui/radio-group.d.ts +1 -1
- package/dist/src/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/components/ui/scroll-area.d.ts +6 -0
- package/dist/src/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/src/components/ui/scroll-area.js +33 -0
- package/dist/src/components/ui/select.d.ts +1 -1
- package/dist/src/components/ui/select.d.ts.map +1 -1
- package/dist/src/components/ui/separator.d.ts +1 -1
- package/dist/src/components/ui/separator.d.ts.map +1 -1
- package/dist/src/components/ui/sheet.d.ts +1 -1
- package/dist/src/components/ui/sheet.d.ts.map +1 -1
- package/dist/src/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/components/ui/sidebar.js +14 -15
- package/dist/src/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/components/ui/switch.d.ts +1 -1
- package/dist/src/components/ui/switch.d.ts.map +1 -1
- package/dist/src/components/ui/table.js +1 -1
- package/dist/src/components/ui/tabs.d.ts +1 -1
- package/dist/src/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/components/ui/toggle.d.ts +1 -1
- package/dist/src/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/components/ui/toggle.js +1 -1
- package/dist/src/components/ui/tooltip.d.ts +5 -2
- package/dist/src/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/components/ui/tooltip.js +18 -2
- 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/users.d.ts +2 -2
- package/dist/src/database/users.js +1 -1
- package/dist/src/drizzle.config.d.ts.map +1 -1
- package/dist/src/drizzle.config.js +1 -1
- package/dist/src/emails/default-template.d.ts.map +1 -1
- package/dist/src/emails/default-template.js +20 -21
- package/dist/src/hooks/use-captcha.d.ts +20 -0
- package/dist/src/hooks/use-captcha.d.ts.map +1 -1
- package/dist/src/hooks/use-captcha.js +19 -18
- package/dist/src/hooks/use-mobile.d.ts.map +1 -1
- package/dist/src/hooks/use-mobile.js +1 -0
- 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/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/config.d.ts +1 -0
- package/dist/src/lib/config.d.ts.map +1 -1
- package/dist/src/lib/config.js +7 -5
- 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 +5 -0
- package/dist/src/lib/fetcher/cookie-from-string-to-object.d.ts.map +1 -1
- package/dist/src/lib/fetcher/core.d.ts.map +1 -1
- package/dist/src/lib/fetcher/core.js +1 -2
- package/dist/src/lib/fetcher-client.d.ts.map +1 -1
- package/dist/src/lib/fetcher.d.ts.map +1 -1
- package/dist/src/lib/helpers/auto-form.d.ts.map +1 -1
- package/dist/src/lib/helpers/auto-form.js +0 -1
- package/dist/src/lib/navigation.d.ts +2 -2
- package/dist/src/lib/navigation.d.ts.map +1 -1
- package/dist/src/lib/tiptap/toolbar/actions/bold-action.d.ts +1 -0
- package/dist/src/lib/tiptap/toolbar/actions/bold-action.d.ts.map +1 -0
- package/dist/src/lib/tiptap/toolbar/actions/bold-action.js +0 -0
- package/dist/src/views/admin/layouts/admin-layout.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/admin-layout.js +5 -2
- package/dist/src/views/admin/layouts/sidebar/nav/item.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/item.js +0 -3
- package/dist/src/views/admin/layouts/sidebar/nav/nav.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/nav.js +12 -1
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts.map +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 +38 -0
- 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/more.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.js +12 -21
- package/dist/src/views/admin/views/core/test.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/test.js +116 -106
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/password-reset/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts.map +1 -1
- 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 +2 -1
- package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/wrapper.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/wrapper.js +6 -3
- package/dist/src/views/auth/sso/callback/client/client.d.ts.map +1 -1
- package/dist/src/views/error/global-error-view.d.ts.map +1 -1
- package/dist/src/views/error/global-error-view.js +2 -1
- package/dist/src/views/layouts/provider.d.ts.map +1 -1
- package/dist/src/views/layouts/root-layout.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/header.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/header.js +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts.map +1 -1
- package/dist/src/vitnode.config.d.ts +2 -0
- package/dist/src/vitnode.config.d.ts.map +1 -1
- package/dist/src/vitnode.config.js +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.mjs +17 -0
- package/package.json +37 -27
- package/src/app_admin/core/advanced/cron/page.tsx +42 -0
- package/src/app_admin/core/debug/page.tsx +1 -1
- package/src/app_admin/core/users/page.tsx +2 -1
- package/src/locales/en.json +51 -0
- package/src/tiptap.css +28 -0
- package/dist/src/components/switchers/langs/language-swietcher.d.ts.map +0 -1
- /package/dist/src/components/switchers/langs/{language-swietcher.js → language-switcher.js} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { buildModule } from "../../../lib/module.js";
|
|
2
|
+
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
3
|
+
import { cronAdminModule } from "./cron/cron.admin.module.js";
|
|
4
|
+
export const advancedAdminModule = buildModule({
|
|
5
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
6
|
+
name: "advanced",
|
|
7
|
+
routes: [],
|
|
8
|
+
modules: [
|
|
9
|
+
cronAdminModule
|
|
10
|
+
]
|
|
11
|
+
});
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
export declare const cronAdminModule: import("../../../../../api/lib/module").BuildModuleReturn<"@vitnode/core", "cron", [{
|
|
2
|
+
handler: (c: import("hono").Context<import("../../../../middlewares/global.middleware").EnvVitNode, "/", {
|
|
3
|
+
in: {
|
|
4
|
+
query: {
|
|
5
|
+
cursor?: string | undefined;
|
|
6
|
+
first?: string | undefined;
|
|
7
|
+
last?: string | undefined;
|
|
8
|
+
order?: "asc" | "desc" | undefined;
|
|
9
|
+
orderBy?: "createdAt" | "lastRun" | "nextRun" | undefined;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
out: {
|
|
13
|
+
query: {
|
|
14
|
+
cursor?: string | undefined;
|
|
15
|
+
first?: string | undefined;
|
|
16
|
+
last?: string | undefined;
|
|
17
|
+
order?: "asc" | "desc" | undefined;
|
|
18
|
+
orderBy?: "createdAt" | "lastRun" | "nextRun" | undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
22
|
+
edges: {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
description: string | null;
|
|
26
|
+
lastRun: string | null;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
pluginId: string;
|
|
29
|
+
module: string;
|
|
30
|
+
nextRun: string | null;
|
|
31
|
+
schedule: string;
|
|
32
|
+
}[];
|
|
33
|
+
pageInfo: {
|
|
34
|
+
count: number;
|
|
35
|
+
endCursor: null | number;
|
|
36
|
+
hasNextPage: boolean;
|
|
37
|
+
hasPreviousPage: boolean;
|
|
38
|
+
startCursor: null | number;
|
|
39
|
+
totalCount: number;
|
|
40
|
+
};
|
|
41
|
+
}, 200, "json">>;
|
|
42
|
+
pluginId: "@vitnode/core";
|
|
43
|
+
route: {
|
|
44
|
+
method: "get";
|
|
45
|
+
description: string;
|
|
46
|
+
path: "/";
|
|
47
|
+
request: {
|
|
48
|
+
query: import("zod").ZodObject<{
|
|
49
|
+
cursor: import("zod").ZodOptional<import("zod").ZodString>;
|
|
50
|
+
first: import("zod").ZodOptional<import("zod").ZodString>;
|
|
51
|
+
last: import("zod").ZodOptional<import("zod").ZodString>;
|
|
52
|
+
order: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
53
|
+
asc: "asc";
|
|
54
|
+
desc: "desc";
|
|
55
|
+
}>>;
|
|
56
|
+
orderBy: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
57
|
+
createdAt: "createdAt";
|
|
58
|
+
lastRun: "lastRun";
|
|
59
|
+
nextRun: "nextRun";
|
|
60
|
+
}>>;
|
|
61
|
+
}, import("zod/v4/core").$strip>;
|
|
62
|
+
};
|
|
63
|
+
responses: {
|
|
64
|
+
200: {
|
|
65
|
+
content: {
|
|
66
|
+
"application/json": {
|
|
67
|
+
schema: import("zod").ZodObject<{
|
|
68
|
+
edges: import("zod").ZodArray<import("zod").ZodObject<{
|
|
69
|
+
id: import("zod").ZodNumber;
|
|
70
|
+
createdAt: import("zod").ZodDate;
|
|
71
|
+
name: import("zod").ZodString;
|
|
72
|
+
description: import("zod").ZodNullable<import("zod").ZodString>;
|
|
73
|
+
pluginId: import("zod").ZodString;
|
|
74
|
+
module: import("zod").ZodString;
|
|
75
|
+
lastRun: import("zod").ZodNullable<import("zod").ZodDate>;
|
|
76
|
+
nextRun: import("zod").ZodNullable<import("zod").ZodDate>;
|
|
77
|
+
schedule: import("zod").ZodString;
|
|
78
|
+
}, import("zod/v4/core").$strip>>;
|
|
79
|
+
pageInfo: import("zod").ZodObject<{
|
|
80
|
+
totalCount: import("zod").ZodNumber;
|
|
81
|
+
count: import("zod").ZodNumber;
|
|
82
|
+
hasNextPage: import("zod").ZodBoolean;
|
|
83
|
+
hasPreviousPage: import("zod").ZodBoolean;
|
|
84
|
+
startCursor: import("zod").ZodNullable<import("zod").ZodNumber>;
|
|
85
|
+
endCursor: import("zod").ZodNullable<import("zod").ZodNumber>;
|
|
86
|
+
}, import("zod/v4/core").$strip>;
|
|
87
|
+
}, import("zod/v4/core").$strip>;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
} & {
|
|
94
|
+
getRoutingPath: () => "/";
|
|
95
|
+
};
|
|
96
|
+
}, {
|
|
97
|
+
handler: (c: import("hono").Context<import("../../../../middlewares/global.middleware").EnvVitNode, "/:id", {
|
|
98
|
+
in: {
|
|
99
|
+
param: {
|
|
100
|
+
id: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
out: {
|
|
104
|
+
param: {
|
|
105
|
+
id: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
}>) => Promise<(Response & import("hono").TypedResponse<{
|
|
109
|
+
error: string;
|
|
110
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
111
|
+
message: string;
|
|
112
|
+
}, 201, "json">) | (Response & import("hono").TypedResponse<{
|
|
113
|
+
error: string;
|
|
114
|
+
}, 500, "json">)>;
|
|
115
|
+
pluginId: "@vitnode/core";
|
|
116
|
+
route: {
|
|
117
|
+
method: "post";
|
|
118
|
+
description: string;
|
|
119
|
+
path: "/{id}";
|
|
120
|
+
request: {
|
|
121
|
+
params: import("zod").ZodObject<{
|
|
122
|
+
id: import("zod").ZodString;
|
|
123
|
+
}, import("zod/v4/core").$strip>;
|
|
124
|
+
};
|
|
125
|
+
responses: {
|
|
126
|
+
201: {
|
|
127
|
+
content: {
|
|
128
|
+
"application/json": {
|
|
129
|
+
schema: import("zod").ZodObject<{
|
|
130
|
+
message: import("zod").ZodOptional<import("zod").ZodString>;
|
|
131
|
+
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
132
|
+
}, import("zod/v4/core").$strip>;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
description: string;
|
|
136
|
+
};
|
|
137
|
+
404: {
|
|
138
|
+
content: {
|
|
139
|
+
"application/json": {
|
|
140
|
+
schema: import("zod").ZodObject<{
|
|
141
|
+
message: import("zod").ZodOptional<import("zod").ZodString>;
|
|
142
|
+
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
143
|
+
}, import("zod/v4/core").$strip>;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
description: string;
|
|
147
|
+
};
|
|
148
|
+
500: {
|
|
149
|
+
content: {
|
|
150
|
+
"application/json": {
|
|
151
|
+
schema: import("zod").ZodObject<{
|
|
152
|
+
message: import("zod").ZodOptional<import("zod").ZodString>;
|
|
153
|
+
error: import("zod").ZodOptional<import("zod").ZodString>;
|
|
154
|
+
}, import("zod/v4/core").$strip>;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
description: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
} & {
|
|
161
|
+
getRoutingPath: () => "/:id";
|
|
162
|
+
};
|
|
163
|
+
}], import("../../../../../api/lib/module").BaseBuildModuleReturn<"@vitnode/core", string, import("../../../../lib/route").Route<"@vitnode/core", import("@hono/zod-openapi").RouteConfig, import("@hono/zod-openapi").RouteHandler<import("@hono/zod-openapi").RouteConfig>>[]>[]>;
|
|
164
|
+
//# sourceMappingURL=cron.admin.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.admin.module.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/advanced/cron/cron.admin.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sQAI1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { buildModule } from "../../../../lib/module.js";
|
|
2
|
+
import { CONFIG_PLUGIN } from "../../../../../config.js";
|
|
3
|
+
import { getCronsRoute } from "./routes/get.route.js";
|
|
4
|
+
import { runCronRoute } from "./routes/run.route.js";
|
|
5
|
+
export const cronAdminModule = buildModule({
|
|
6
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
7
|
+
name: "cron",
|
|
8
|
+
routes: [
|
|
9
|
+
getCronsRoute,
|
|
10
|
+
runCronRoute
|
|
11
|
+
]
|
|
12
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const getCronsRoute: {
|
|
3
|
+
handler: (c: import("hono").Context<import("../../../../../middlewares/global.middleware").EnvVitNode, "/", {
|
|
4
|
+
in: {
|
|
5
|
+
query: {
|
|
6
|
+
cursor?: string | undefined;
|
|
7
|
+
first?: string | undefined;
|
|
8
|
+
last?: string | undefined;
|
|
9
|
+
order?: "asc" | "desc" | undefined;
|
|
10
|
+
orderBy?: "createdAt" | "lastRun" | "nextRun" | undefined;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
out: {
|
|
14
|
+
query: {
|
|
15
|
+
cursor?: string | undefined;
|
|
16
|
+
first?: string | undefined;
|
|
17
|
+
last?: string | undefined;
|
|
18
|
+
order?: "asc" | "desc" | undefined;
|
|
19
|
+
orderBy?: "createdAt" | "lastRun" | "nextRun" | undefined;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
23
|
+
edges: {
|
|
24
|
+
id: number;
|
|
25
|
+
name: string;
|
|
26
|
+
description: string | null;
|
|
27
|
+
lastRun: string | null;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
pluginId: string;
|
|
30
|
+
module: string;
|
|
31
|
+
nextRun: string | null;
|
|
32
|
+
schedule: string;
|
|
33
|
+
}[];
|
|
34
|
+
pageInfo: {
|
|
35
|
+
count: number;
|
|
36
|
+
endCursor: null | number;
|
|
37
|
+
hasNextPage: boolean;
|
|
38
|
+
hasPreviousPage: boolean;
|
|
39
|
+
startCursor: null | number;
|
|
40
|
+
totalCount: number;
|
|
41
|
+
};
|
|
42
|
+
}, 200, "json">>;
|
|
43
|
+
pluginId: "@vitnode/core";
|
|
44
|
+
route: {
|
|
45
|
+
method: "get";
|
|
46
|
+
description: string;
|
|
47
|
+
path: "/";
|
|
48
|
+
request: {
|
|
49
|
+
query: z.ZodObject<{
|
|
50
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
51
|
+
first: z.ZodOptional<z.ZodString>;
|
|
52
|
+
last: z.ZodOptional<z.ZodString>;
|
|
53
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
asc: "asc";
|
|
55
|
+
desc: "desc";
|
|
56
|
+
}>>;
|
|
57
|
+
orderBy: z.ZodOptional<z.ZodEnum<{
|
|
58
|
+
createdAt: "createdAt";
|
|
59
|
+
lastRun: "lastRun";
|
|
60
|
+
nextRun: "nextRun";
|
|
61
|
+
}>>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
};
|
|
64
|
+
responses: {
|
|
65
|
+
200: {
|
|
66
|
+
content: {
|
|
67
|
+
"application/json": {
|
|
68
|
+
schema: z.ZodObject<{
|
|
69
|
+
edges: z.ZodArray<z.ZodObject<{
|
|
70
|
+
id: z.ZodNumber;
|
|
71
|
+
createdAt: z.ZodDate;
|
|
72
|
+
name: z.ZodString;
|
|
73
|
+
description: z.ZodNullable<z.ZodString>;
|
|
74
|
+
pluginId: z.ZodString;
|
|
75
|
+
module: z.ZodString;
|
|
76
|
+
lastRun: z.ZodNullable<z.ZodDate>;
|
|
77
|
+
nextRun: z.ZodNullable<z.ZodDate>;
|
|
78
|
+
schedule: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
pageInfo: z.ZodObject<{
|
|
81
|
+
totalCount: z.ZodNumber;
|
|
82
|
+
count: z.ZodNumber;
|
|
83
|
+
hasNextPage: z.ZodBoolean;
|
|
84
|
+
hasPreviousPage: z.ZodBoolean;
|
|
85
|
+
startCursor: z.ZodNullable<z.ZodNumber>;
|
|
86
|
+
endCursor: z.ZodNullable<z.ZodNumber>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
description: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
} & {
|
|
95
|
+
getRoutingPath: () => "/";
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=get.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/modules/admin/advanced/cron/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAWpB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DxB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { buildRoute } from "../../../../../lib/route.js";
|
|
3
|
+
import { withPagination, zodPaginationPageInfo, zodPaginationQuery } from "../../../../../lib/with-pagination.js";
|
|
4
|
+
import { CONFIG_PLUGIN } from "../../../../../../config.js";
|
|
5
|
+
import { core_cron } from "../../../../../../database/cron.js";
|
|
6
|
+
export const getCronsRoute = buildRoute({
|
|
7
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
8
|
+
route: {
|
|
9
|
+
method: "get",
|
|
10
|
+
description: "Get Admin Cron Logs",
|
|
11
|
+
path: "/",
|
|
12
|
+
request: {
|
|
13
|
+
query: zodPaginationQuery.extend({
|
|
14
|
+
order: z.enum([
|
|
15
|
+
"asc",
|
|
16
|
+
"desc"
|
|
17
|
+
]).optional(),
|
|
18
|
+
orderBy: z.enum([
|
|
19
|
+
"createdAt",
|
|
20
|
+
"lastRun",
|
|
21
|
+
"nextRun"
|
|
22
|
+
]).optional()
|
|
23
|
+
})
|
|
24
|
+
},
|
|
25
|
+
responses: {
|
|
26
|
+
200: {
|
|
27
|
+
content: {
|
|
28
|
+
"application/json": {
|
|
29
|
+
schema: z.object({
|
|
30
|
+
edges: z.array(z.object({
|
|
31
|
+
id: z.number(),
|
|
32
|
+
createdAt: z.date(),
|
|
33
|
+
name: z.string(),
|
|
34
|
+
description: z.string().nullable(),
|
|
35
|
+
pluginId: z.string(),
|
|
36
|
+
module: z.string(),
|
|
37
|
+
lastRun: z.date().nullable(),
|
|
38
|
+
nextRun: z.date().nullable(),
|
|
39
|
+
schedule: z.string()
|
|
40
|
+
})),
|
|
41
|
+
pageInfo: zodPaginationPageInfo
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
description: "List of cron jobs"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
handler: async (c)=>{
|
|
50
|
+
const query = c.req.valid("query");
|
|
51
|
+
const data = await withPagination({
|
|
52
|
+
params: {
|
|
53
|
+
query
|
|
54
|
+
},
|
|
55
|
+
c,
|
|
56
|
+
primaryCursor: core_cron.id,
|
|
57
|
+
query: async ({ limit, where, orderBy })=>await c.get("db").select().from(core_cron).where(where).orderBy(orderBy).limit(limit),
|
|
58
|
+
table: core_cron,
|
|
59
|
+
orderBy: {
|
|
60
|
+
column: query.orderBy ? core_cron[query.orderBy] : core_cron.lastRun,
|
|
61
|
+
order: query.order ?? "desc"
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return c.json(data);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const runCronRoute: {
|
|
3
|
+
handler: (c: import("hono").Context<import("../../../../../middlewares/global.middleware").EnvVitNode, "/:id", {
|
|
4
|
+
in: {
|
|
5
|
+
param: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
out: {
|
|
10
|
+
param: {
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}>) => Promise<(Response & import("hono").TypedResponse<{
|
|
15
|
+
error: string;
|
|
16
|
+
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
17
|
+
message: string;
|
|
18
|
+
}, 201, "json">) | (Response & import("hono").TypedResponse<{
|
|
19
|
+
error: string;
|
|
20
|
+
}, 500, "json">)>;
|
|
21
|
+
pluginId: "@vitnode/core";
|
|
22
|
+
route: {
|
|
23
|
+
method: "post";
|
|
24
|
+
description: string;
|
|
25
|
+
path: "/{id}";
|
|
26
|
+
request: {
|
|
27
|
+
params: z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
};
|
|
31
|
+
responses: {
|
|
32
|
+
201: {
|
|
33
|
+
content: {
|
|
34
|
+
"application/json": {
|
|
35
|
+
schema: z.ZodObject<{
|
|
36
|
+
message: z.ZodOptional<z.ZodString>;
|
|
37
|
+
error: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
404: {
|
|
44
|
+
content: {
|
|
45
|
+
"application/json": {
|
|
46
|
+
schema: z.ZodObject<{
|
|
47
|
+
message: z.ZodOptional<z.ZodString>;
|
|
48
|
+
error: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
500: {
|
|
55
|
+
content: {
|
|
56
|
+
"application/json": {
|
|
57
|
+
schema: z.ZodObject<{
|
|
58
|
+
message: z.ZodOptional<z.ZodString>;
|
|
59
|
+
error: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
} & {
|
|
67
|
+
getRoutingPath: () => "/:id";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=run.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/modules/admin/advanced/cron/routes/run.route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GvB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { eq } from "drizzle-orm";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { buildRoute } from "../../../../../lib/route.js";
|
|
4
|
+
import { CONFIG_PLUGIN } from "../../../../../../config.js";
|
|
5
|
+
import { core_cron } from "../../../../../../database/cron.js";
|
|
6
|
+
import { getNextCronRunDate } from "../../../../../../lib/api/get-next-cron-run-date.js";
|
|
7
|
+
export const runCronRoute = buildRoute({
|
|
8
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
9
|
+
route: {
|
|
10
|
+
method: "post",
|
|
11
|
+
description: "Run a specific cron job",
|
|
12
|
+
path: "/{id}",
|
|
13
|
+
request: {
|
|
14
|
+
params: z.object({
|
|
15
|
+
id: z.string()
|
|
16
|
+
})
|
|
17
|
+
},
|
|
18
|
+
responses: {
|
|
19
|
+
201: {
|
|
20
|
+
content: {
|
|
21
|
+
"application/json": {
|
|
22
|
+
schema: z.object({
|
|
23
|
+
message: z.string().optional(),
|
|
24
|
+
error: z.string().optional()
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
description: "Cron job executed successfully"
|
|
29
|
+
},
|
|
30
|
+
404: {
|
|
31
|
+
content: {
|
|
32
|
+
"application/json": {
|
|
33
|
+
schema: z.object({
|
|
34
|
+
message: z.string().optional(),
|
|
35
|
+
error: z.string().optional()
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
description: "Cron job not found"
|
|
40
|
+
},
|
|
41
|
+
500: {
|
|
42
|
+
content: {
|
|
43
|
+
"application/json": {
|
|
44
|
+
schema: z.object({
|
|
45
|
+
message: z.string().optional(),
|
|
46
|
+
error: z.string().optional()
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
description: "Internal server error"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
handler: async (c)=>{
|
|
55
|
+
const db = c.get("db");
|
|
56
|
+
const cronJobs = c.get("core").cron;
|
|
57
|
+
const param = c.req.valid("param");
|
|
58
|
+
try {
|
|
59
|
+
const cronFromDb = await db.select().from(core_cron).where(eq(core_cron.id, +param.id)).limit(1);
|
|
60
|
+
if (cronFromDb.length === 0) {
|
|
61
|
+
return c.json({
|
|
62
|
+
error: "Cron job not found"
|
|
63
|
+
}, 404);
|
|
64
|
+
}
|
|
65
|
+
const dbCron = cronFromDb[0];
|
|
66
|
+
const job = cronJobs.find((j)=>j.name === dbCron.name && j.pluginId === dbCron.pluginId && j.module === dbCron.module);
|
|
67
|
+
if (!job) {
|
|
68
|
+
return c.json({
|
|
69
|
+
error: "Cron job configuration not found"
|
|
70
|
+
}, 404);
|
|
71
|
+
}
|
|
72
|
+
const now = new Date();
|
|
73
|
+
try {
|
|
74
|
+
await job.handler(c);
|
|
75
|
+
await db.update(core_cron).set({
|
|
76
|
+
lastRun: now,
|
|
77
|
+
nextRun: getNextCronRunDate(job.schedule, now)
|
|
78
|
+
}).where(eq(core_cron.id, dbCron.id));
|
|
79
|
+
return c.json({
|
|
80
|
+
message: "Cron job executed successfully"
|
|
81
|
+
}, 201);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
await c.get("log").error(`Error executing cron job: ${error}`);
|
|
84
|
+
return c.json({
|
|
85
|
+
error: "Failed to execute cron job"
|
|
86
|
+
}, 500);
|
|
87
|
+
}
|
|
88
|
+
} catch (error) {
|
|
89
|
+
await c.get("log").error(`Error running cron job: ${error}`);
|
|
90
|
+
return c.json({
|
|
91
|
+
error: "Internal server error"
|
|
92
|
+
}, 500);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
@@ -2,7 +2,7 @@ import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
|
2
2
|
import { buildModule } from "../../../lib/module.js";
|
|
3
3
|
import { logsDebugAdminRoute } from "./routes/logs.route.js";
|
|
4
4
|
export const debugAdminModule = buildModule({
|
|
5
|
-
|
|
5
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
6
6
|
name: "debug",
|
|
7
7
|
routes: [
|
|
8
8
|
logsDebugAdminRoute
|
|
@@ -6,7 +6,7 @@ import { core_users } from "../../../../../database/users.js";
|
|
|
6
6
|
import { buildRoute } from "../../../../lib/route.js";
|
|
7
7
|
import { withPagination, zodPaginationPageInfo, zodPaginationQuery } from "../../../../lib/with-pagination.js";
|
|
8
8
|
export const logsDebugAdminRoute = buildRoute({
|
|
9
|
-
|
|
9
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
10
10
|
route: {
|
|
11
11
|
method: "get",
|
|
12
12
|
description: "Get Admin Debug Logs",
|
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { buildRoute } from "../../../lib/route.js";
|
|
4
4
|
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
5
5
|
export const sessionAdminRoute = buildRoute({
|
|
6
|
-
|
|
6
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
7
7
|
route: {
|
|
8
8
|
method: "get",
|
|
9
9
|
description: "Verify admin session",
|
|
@@ -4,7 +4,7 @@ import { withPagination, zodPaginationPageInfo, zodPaginationQuery } from "../..
|
|
|
4
4
|
import { CONFIG_PLUGIN } from "../../../../../config.js";
|
|
5
5
|
import { core_users } from "../../../../../database/users.js";
|
|
6
6
|
export const listUsersAdminRoute = buildRoute({
|
|
7
|
-
|
|
7
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
8
8
|
route: {
|
|
9
9
|
method: "get",
|
|
10
10
|
description: "Get list of all users",
|
|
@@ -7,7 +7,7 @@ export declare const usersAdminRoute: {
|
|
|
7
7
|
first?: string | undefined;
|
|
8
8
|
last?: string | undefined;
|
|
9
9
|
order?: "asc" | "desc" | undefined;
|
|
10
|
-
orderBy?: "
|
|
10
|
+
orderBy?: "id" | "email" | "name" | "createdAt" | undefined;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
out: {
|
|
@@ -16,7 +16,7 @@ export declare const usersAdminRoute: {
|
|
|
16
16
|
first?: string | undefined;
|
|
17
17
|
last?: string | undefined;
|
|
18
18
|
order?: "asc" | "desc" | undefined;
|
|
19
|
-
orderBy?: "
|
|
19
|
+
orderBy?: "id" | "email" | "name" | "createdAt" | undefined;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
@@ -57,8 +57,8 @@ export declare const usersAdminRoute: {
|
|
|
57
57
|
desc: "desc";
|
|
58
58
|
}>>;
|
|
59
59
|
orderBy: z.ZodOptional<z.ZodEnum<{
|
|
60
|
-
email: "email";
|
|
61
60
|
id: "id";
|
|
61
|
+
email: "email";
|
|
62
62
|
name: "name";
|
|
63
63
|
createdAt: "createdAt";
|
|
64
64
|
}>>;
|
|
@@ -4,7 +4,7 @@ import { withPagination, zodPaginationPageInfo, zodPaginationQuery } from "../..
|
|
|
4
4
|
import { CONFIG_PLUGIN } from "../../../../../config.js";
|
|
5
5
|
import { core_users } from "../../../../../database/users.js";
|
|
6
6
|
export const usersAdminRoute = buildRoute({
|
|
7
|
-
|
|
7
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
8
8
|
route: {
|
|
9
9
|
method: "get",
|
|
10
10
|
description: "Get list of all users (Admin only)",
|
|
@@ -2,7 +2,7 @@ import { buildModule } from "../../../lib/module.js";
|
|
|
2
2
|
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
3
3
|
import { listUsersAdminRoute } from "./routes/list.route.js";
|
|
4
4
|
export const usersAdminModule = buildModule({
|
|
5
|
-
|
|
5
|
+
pluginId: CONFIG_PLUGIN.pluginId,
|
|
6
6
|
name: "users",
|
|
7
7
|
routes: [
|
|
8
8
|
listUsersAdminRoute
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean.cron.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/cron/cron/clean.cron.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,0CA0BpB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { lt } from "drizzle-orm";
|
|
2
|
+
import { buildCron } from "../../../lib/cron.js";
|
|
3
|
+
import { core_admin_sessions } from "../../../../database/admins.js";
|
|
4
|
+
import { core_sessions } from "../../../../database/sessions.js";
|
|
5
|
+
import { core_users_forgot_password } from "../../../../database/users.js";
|
|
6
|
+
export const cleanCron = buildCron({
|
|
7
|
+
name: "clean",
|
|
8
|
+
description: "Clean up expired sessions and tokens",
|
|
9
|
+
// Run every 1 hour
|
|
10
|
+
schedule: "0 * * * *",
|
|
11
|
+
handler: async (c)=>{
|
|
12
|
+
await c.get("db").transaction(async (tx)=>{
|
|
13
|
+
// Delete expired sessions
|
|
14
|
+
await tx.delete(core_sessions).where(lt(core_sessions.expiresAt, new Date()));
|
|
15
|
+
await tx.delete(core_admin_sessions).where(lt(core_admin_sessions.expiresAt, new Date()));
|
|
16
|
+
// Delete expired forgot password tokens
|
|
17
|
+
await tx.delete(core_users_forgot_password).where(lt(core_users_forgot_password.expiresAt, new Date()));
|
|
18
|
+
// // Delete expired email confirmation tokens
|
|
19
|
+
// await tx
|
|
20
|
+
// .delete(core_users_confirm_emails)
|
|
21
|
+
// .where(lt(core_users_confirm_emails.expiresAt, new Date()));
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|