@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
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { shouldCronJobRun } from "./should-cron-job-run.js";
|
|
3
|
+
describe("shouldCronJobRun", ()=>{
|
|
4
|
+
beforeEach(()=>{
|
|
5
|
+
// Reset any mocked console methods
|
|
6
|
+
vi.clearAllMocks();
|
|
7
|
+
});
|
|
8
|
+
describe("valid cron schedules", ()=>{
|
|
9
|
+
it("should return true when job has never run (lastRun is null)", ()=>{
|
|
10
|
+
const schedule = "0 * * * *"; // Every hour
|
|
11
|
+
const lastRun = null;
|
|
12
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
13
|
+
expect(result).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
it("should return true when enough time has passed since last run", ()=>{
|
|
16
|
+
const schedule = "0 * * * *"; // Every hour
|
|
17
|
+
const lastRun = new Date("2024-01-01T10:00:00Z");
|
|
18
|
+
// Mock current time to be 2 hours later
|
|
19
|
+
vi.useFakeTimers();
|
|
20
|
+
vi.setSystemTime(new Date("2024-01-01T12:00:00Z"));
|
|
21
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
22
|
+
expect(result).toBe(true);
|
|
23
|
+
vi.useRealTimers();
|
|
24
|
+
});
|
|
25
|
+
it("should return false when not enough time has passed since last run", ()=>{
|
|
26
|
+
const schedule = "0 * * * *"; // Every hour
|
|
27
|
+
const lastRun = new Date("2024-01-01T11:30:00Z");
|
|
28
|
+
// Mock current time to be 15 minutes later (not enough for hourly job)
|
|
29
|
+
vi.useFakeTimers();
|
|
30
|
+
vi.setSystemTime(new Date("2024-01-01T11:45:00Z"));
|
|
31
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
32
|
+
expect(result).toBe(false);
|
|
33
|
+
vi.useRealTimers();
|
|
34
|
+
});
|
|
35
|
+
it("should handle daily job correctly", ()=>{
|
|
36
|
+
const schedule = "0 9 * * *"; // Every day at 9 AM
|
|
37
|
+
const lastRun = new Date("2024-01-01T09:00:00Z");
|
|
38
|
+
// Mock current time to be next day at 10 AM
|
|
39
|
+
vi.useFakeTimers();
|
|
40
|
+
vi.setSystemTime(new Date("2024-01-02T10:00:00Z"));
|
|
41
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
42
|
+
expect(result).toBe(true);
|
|
43
|
+
vi.useRealTimers();
|
|
44
|
+
});
|
|
45
|
+
it("should handle weekly job correctly", ()=>{
|
|
46
|
+
const schedule = "0 9 * * 1"; // Every Monday at 9 AM
|
|
47
|
+
const lastRun = new Date("2024-01-01T09:00:00Z"); // Monday
|
|
48
|
+
// Mock current time to be next Monday
|
|
49
|
+
vi.useFakeTimers();
|
|
50
|
+
vi.setSystemTime(new Date("2024-01-08T10:00:00Z")); // Next Monday
|
|
51
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
52
|
+
expect(result).toBe(true);
|
|
53
|
+
vi.useRealTimers();
|
|
54
|
+
});
|
|
55
|
+
it("should handle monthly job correctly", ()=>{
|
|
56
|
+
const schedule = "0 9 1 * *"; // First day of every month at 9 AM
|
|
57
|
+
const lastRun = new Date("2024-01-01T09:00:00Z");
|
|
58
|
+
// Mock current time to be next month
|
|
59
|
+
vi.useFakeTimers();
|
|
60
|
+
vi.setSystemTime(new Date("2024-02-01T10:00:00Z"));
|
|
61
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
62
|
+
expect(result).toBe(true);
|
|
63
|
+
vi.useRealTimers();
|
|
64
|
+
});
|
|
65
|
+
it("should handle every minute job correctly", ()=>{
|
|
66
|
+
const schedule = "* * * * *"; // Every minute
|
|
67
|
+
const lastRun = new Date("2024-01-01T10:00:00Z");
|
|
68
|
+
// Mock current time to be 1 minute later
|
|
69
|
+
vi.useFakeTimers();
|
|
70
|
+
vi.setSystemTime(new Date("2024-01-01T10:01:00Z"));
|
|
71
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
72
|
+
expect(result).toBe(true);
|
|
73
|
+
vi.useRealTimers();
|
|
74
|
+
});
|
|
75
|
+
it("should handle every 5 minutes job correctly", ()=>{
|
|
76
|
+
const schedule = "*/5 * * * *"; // Every 5 minutes
|
|
77
|
+
const lastRun = new Date("2024-01-01T10:00:00Z");
|
|
78
|
+
// Mock current time to be 3 minutes later (not enough)
|
|
79
|
+
vi.useFakeTimers();
|
|
80
|
+
vi.setSystemTime(new Date("2024-01-01T10:03:00Z"));
|
|
81
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
82
|
+
expect(result).toBe(false);
|
|
83
|
+
// Mock current time to be 5 minutes later (enough)
|
|
84
|
+
vi.setSystemTime(new Date("2024-01-01T10:05:00Z"));
|
|
85
|
+
const result2 = shouldCronJobRun(schedule, lastRun);
|
|
86
|
+
expect(result2).toBe(true);
|
|
87
|
+
vi.useRealTimers();
|
|
88
|
+
});
|
|
89
|
+
it("should handle complex cron expressions", ()=>{
|
|
90
|
+
const schedule = "0 9-17 * * 1-5"; // 9 AM to 5 PM on weekdays
|
|
91
|
+
const lastRun = new Date("2024-01-01T09:00:00Z"); // Monday 9 AM
|
|
92
|
+
// Mock current time to be same day at 10 AM
|
|
93
|
+
vi.useFakeTimers();
|
|
94
|
+
vi.setSystemTime(new Date("2024-01-01T10:00:00Z"));
|
|
95
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
96
|
+
expect(result).toBe(true);
|
|
97
|
+
vi.useRealTimers();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
describe("invalid cron schedules", ()=>{
|
|
101
|
+
it("should return false and log error for invalid cron schedule", ()=>{
|
|
102
|
+
const consoleErrorSpy = vi.spyOn(console, "error").mockImplementation(()=>{});
|
|
103
|
+
const schedule = "invalid cron"; // Invalid schedule
|
|
104
|
+
const lastRun = null;
|
|
105
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
106
|
+
expect(result).toBe(false);
|
|
107
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining("[VitNode]") && expect.stringContaining("Error parsing schedule") && expect.stringContaining("invalid cron"), expect.any(Error));
|
|
108
|
+
consoleErrorSpy.mockRestore();
|
|
109
|
+
});
|
|
110
|
+
it("should return false for malformed cron expression", ()=>{
|
|
111
|
+
const consoleErrorSpy = vi.spyOn(console, "error").mockImplementation(()=>{});
|
|
112
|
+
const schedule = "60 * * * *"; // Invalid minute (should be 0-59)
|
|
113
|
+
const lastRun = null;
|
|
114
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
115
|
+
expect(result).toBe(false);
|
|
116
|
+
expect(consoleErrorSpy).toHaveBeenCalled();
|
|
117
|
+
consoleErrorSpy.mockRestore();
|
|
118
|
+
});
|
|
119
|
+
it("should return true for empty cron schedule (parsed as valid)", ()=>{
|
|
120
|
+
// Note: cron-parser actually parses empty string as a valid cron expression
|
|
121
|
+
const schedule = ""; // Empty schedule
|
|
122
|
+
const lastRun = null;
|
|
123
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
124
|
+
expect(result).toBe(true);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
describe("edge cases", ()=>{
|
|
128
|
+
it("should handle lastRun being exactly at the next scheduled time", ()=>{
|
|
129
|
+
const schedule = "0 * * * *"; // Every hour
|
|
130
|
+
const lastRun = new Date("2024-01-01T10:00:00Z");
|
|
131
|
+
// Mock current time to be exactly at the next scheduled time
|
|
132
|
+
vi.useFakeTimers();
|
|
133
|
+
vi.setSystemTime(new Date("2024-01-01T11:00:00Z"));
|
|
134
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
135
|
+
expect(result).toBe(true);
|
|
136
|
+
vi.useRealTimers();
|
|
137
|
+
});
|
|
138
|
+
it("should handle lastRun being in the future (clock skew)", ()=>{
|
|
139
|
+
const schedule = "0 * * * *"; // Every hour
|
|
140
|
+
const lastRun = new Date("2024-01-01T12:00:00Z"); // Future time
|
|
141
|
+
// Mock current time to be earlier
|
|
142
|
+
vi.useFakeTimers();
|
|
143
|
+
vi.setSystemTime(new Date("2024-01-01T11:00:00Z"));
|
|
144
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
145
|
+
expect(result).toBe(false);
|
|
146
|
+
vi.useRealTimers();
|
|
147
|
+
});
|
|
148
|
+
it("should handle lastRun being epoch (new Date(0))", ()=>{
|
|
149
|
+
const schedule = "0 * * * *"; // Every hour
|
|
150
|
+
const lastRun = new Date(0); // Epoch time
|
|
151
|
+
// Mock current time to be much later
|
|
152
|
+
vi.useFakeTimers();
|
|
153
|
+
vi.setSystemTime(new Date("2024-01-01T10:00:00Z"));
|
|
154
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
155
|
+
expect(result).toBe(true);
|
|
156
|
+
vi.useRealTimers();
|
|
157
|
+
});
|
|
158
|
+
it("should handle yearly cron job", ()=>{
|
|
159
|
+
const schedule = "0 0 1 1 *"; // January 1st at midnight
|
|
160
|
+
const lastRun = new Date("2023-01-01T00:00:00Z");
|
|
161
|
+
// Mock current time to be next year
|
|
162
|
+
vi.useFakeTimers();
|
|
163
|
+
vi.setSystemTime(new Date("2024-01-01T01:00:00Z"));
|
|
164
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
165
|
+
expect(result).toBe(true);
|
|
166
|
+
vi.useRealTimers();
|
|
167
|
+
});
|
|
168
|
+
it("should handle specific day of month with month", ()=>{
|
|
169
|
+
const schedule = "0 12 15 6 *"; // June 15th at noon
|
|
170
|
+
const lastRun = new Date("2023-06-15T12:00:00Z");
|
|
171
|
+
// Mock current time to be next year same date
|
|
172
|
+
vi.useFakeTimers();
|
|
173
|
+
vi.setSystemTime(new Date("2024-06-15T13:00:00Z"));
|
|
174
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
175
|
+
expect(result).toBe(true);
|
|
176
|
+
vi.useRealTimers();
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
describe("timezone handling", ()=>{
|
|
180
|
+
it("should work with different timezone dates", ()=>{
|
|
181
|
+
const schedule = "0 9 * * *"; // Every day at 9 AM
|
|
182
|
+
const lastRun = new Date("2024-01-01T09:00:00+05:00"); // 9 AM in +5 timezone
|
|
183
|
+
// Mock current time to be next day in UTC
|
|
184
|
+
vi.useFakeTimers();
|
|
185
|
+
vi.setSystemTime(new Date("2024-01-02T04:00:00Z")); // 9 AM in +5 timezone
|
|
186
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
187
|
+
expect(result).toBe(true);
|
|
188
|
+
vi.useRealTimers();
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
describe("performance and boundary conditions", ()=>{
|
|
192
|
+
it("should handle very old lastRun dates", ()=>{
|
|
193
|
+
const schedule = "0 * * * *"; // Every hour
|
|
194
|
+
const lastRun = new Date("1970-01-01T00:00:00Z"); // Very old date
|
|
195
|
+
// Current time
|
|
196
|
+
vi.useFakeTimers();
|
|
197
|
+
vi.setSystemTime(new Date("2024-01-01T10:00:00Z"));
|
|
198
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
199
|
+
expect(result).toBe(true);
|
|
200
|
+
vi.useRealTimers();
|
|
201
|
+
});
|
|
202
|
+
it("should handle leap year considerations", ()=>{
|
|
203
|
+
const schedule = "0 0 29 2 *"; // February 29th (leap day)
|
|
204
|
+
const lastRun = new Date("2020-02-29T00:00:00Z"); // Last leap year
|
|
205
|
+
// Mock current time to be next leap year
|
|
206
|
+
vi.useFakeTimers();
|
|
207
|
+
vi.setSystemTime(new Date("2024-02-29T01:00:00Z"));
|
|
208
|
+
const result = shouldCronJobRun(schedule, lastRun);
|
|
209
|
+
expect(result).toBe(true);
|
|
210
|
+
vi.useRealTimers();
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
});
|
package/dist/src/lib/colors.js
CHANGED
|
@@ -5,19 +5,21 @@ export const convertColor = {
|
|
|
5
5
|
const f = (n)=>{
|
|
6
6
|
const k = (n + h / 30) % 12;
|
|
7
7
|
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
8
|
-
return Math.round(255 * color).toString(16).padStart(2,
|
|
8
|
+
return Math.round(255 * color).toString(16).padStart(2, "0");
|
|
9
9
|
};
|
|
10
10
|
return `${f(0)}${f(8)}${f(4)}`;
|
|
11
11
|
},
|
|
12
12
|
hexToHSL: (hex)=>{
|
|
13
13
|
if (!hexRegex.test(hex)) return undefined;
|
|
14
|
-
let b = 0
|
|
14
|
+
let b = 0;
|
|
15
|
+
let g = 0;
|
|
16
|
+
let r = 0;
|
|
15
17
|
// 3 digits
|
|
16
|
-
if (hex.length
|
|
18
|
+
if (hex.length === 4) {
|
|
17
19
|
r = parseInt(hex[1] + hex[1], 16);
|
|
18
20
|
g = parseInt(hex[2] + hex[2], 16);
|
|
19
21
|
b = parseInt(hex[3] + hex[3], 16);
|
|
20
|
-
} else if (hex.length
|
|
22
|
+
} else if (hex.length === 7) {
|
|
21
23
|
r = parseInt(hex[1] + hex[2], 16);
|
|
22
24
|
g = parseInt(hex[3] + hex[4], 16);
|
|
23
25
|
b = parseInt(hex[5] + hex[6], 16);
|
|
@@ -25,15 +27,18 @@ export const convertColor = {
|
|
|
25
27
|
return undefined;
|
|
26
28
|
}
|
|
27
29
|
// Check if any of the parsed values are NaN
|
|
28
|
-
if (isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
30
|
+
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
|
|
29
31
|
return undefined;
|
|
30
32
|
}
|
|
31
33
|
r /= 255;
|
|
32
34
|
g /= 255;
|
|
33
35
|
b /= 255;
|
|
34
|
-
const max = Math.max(r, g, b)
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const max = Math.max(r, g, b);
|
|
37
|
+
const min = Math.min(r, g, b);
|
|
38
|
+
const l = (max + min) / 2;
|
|
39
|
+
let h = 0;
|
|
40
|
+
let s = 0;
|
|
41
|
+
if (max === min) {
|
|
37
42
|
h = s = 0; // achromatic
|
|
38
43
|
} else {
|
|
39
44
|
const d = max - min;
|
|
@@ -63,12 +68,16 @@ export const convertColor = {
|
|
|
63
68
|
g /= 255;
|
|
64
69
|
b /= 255;
|
|
65
70
|
// Find greatest and smallest channel values
|
|
66
|
-
const cmax = Math.max(r, g, b)
|
|
67
|
-
|
|
71
|
+
const cmax = Math.max(r, g, b);
|
|
72
|
+
const cmin = Math.min(r, g, b);
|
|
73
|
+
const delta = cmax - cmin;
|
|
74
|
+
let h = 0;
|
|
75
|
+
let l = 0;
|
|
76
|
+
let s = 0;
|
|
68
77
|
// Calculate hue
|
|
69
|
-
if (delta
|
|
70
|
-
else if (cmax
|
|
71
|
-
else if (cmax
|
|
78
|
+
if (delta === 0) h = 0;
|
|
79
|
+
else if (cmax === r) h = (g - b) / delta % 6;
|
|
80
|
+
else if (cmax === g) h = (b - r) / delta + 2;
|
|
72
81
|
else h = (r - g) / delta + 4;
|
|
73
82
|
h = Math.round(h * 60);
|
|
74
83
|
// Make negative hues positive behind 360°
|
|
@@ -76,7 +85,7 @@ export const convertColor = {
|
|
|
76
85
|
// Calculate lightness
|
|
77
86
|
l = (cmax + cmin) / 2;
|
|
78
87
|
// Calculate saturation
|
|
79
|
-
s = delta
|
|
88
|
+
s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
80
89
|
// Multiply l and s by 100
|
|
81
90
|
s = +(s * 100).toFixed(1);
|
|
82
91
|
l = +(l * 100).toFixed(1);
|
|
@@ -92,7 +101,7 @@ export const convertColor = {
|
|
|
92
101
|
const f = (n)=>{
|
|
93
102
|
const k = (n + h / 30) % 12;
|
|
94
103
|
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
95
|
-
return Math.round(255 * color).toString(16).padStart(2,
|
|
104
|
+
return Math.round(255 * color).toString(16).padStart(2, "0"); // convert to Hex and prefix "0" if needed
|
|
96
105
|
};
|
|
97
106
|
return {
|
|
98
107
|
r: f(0),
|
|
@@ -107,19 +116,19 @@ export const rgbWithCommaRegex = /^rgb\(\s*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][
|
|
|
107
116
|
export const rgbWithoutCommaRegex = /^rgb\(\s*([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\s+([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\s+([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\s*\)$/;
|
|
108
117
|
export const checkColorType = (strColor)=>{
|
|
109
118
|
if (hexRegex.test(strColor)) {
|
|
110
|
-
return
|
|
119
|
+
return "hex";
|
|
111
120
|
}
|
|
112
121
|
if (hslRegex.test(strColor)) {
|
|
113
|
-
return
|
|
122
|
+
return "hsl";
|
|
114
123
|
}
|
|
115
124
|
if (rgbWithoutCommaRegex.test(strColor) || rgbWithCommaRegex.test(strColor)) {
|
|
116
|
-
return
|
|
125
|
+
return "rgb";
|
|
117
126
|
}
|
|
118
127
|
return null;
|
|
119
128
|
};
|
|
120
129
|
export const getHSLFromString = (string)=>{
|
|
121
130
|
if (!hslRegex.test(string)) return null;
|
|
122
|
-
const [h, s, l] = string.replaceAll(
|
|
131
|
+
const [h, s, l] = string.replaceAll("hsl(", "").replaceAll(")", "").replaceAll("%", "").split(",").map(Number);
|
|
123
132
|
return {
|
|
124
133
|
h,
|
|
125
134
|
s,
|
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { checkColorType, convertColor, getHSLFromString, getStringFromHSL } from "./colors.js";
|
|
3
|
-
describe(
|
|
4
|
-
describe(
|
|
5
|
-
it(
|
|
3
|
+
describe("convertColor", ()=>{
|
|
4
|
+
describe("hslToHex", ()=>{
|
|
5
|
+
it("should convert HSL to hex correctly", ()=>{
|
|
6
6
|
const hsl = {
|
|
7
7
|
h: 0,
|
|
8
8
|
s: 100,
|
|
9
9
|
l: 50
|
|
10
10
|
}; // Red
|
|
11
|
-
expect(convertColor.hslToHex(hsl)).toBe(
|
|
11
|
+
expect(convertColor.hslToHex(hsl)).toBe("ff0000");
|
|
12
12
|
const hsl2 = {
|
|
13
13
|
h: 120,
|
|
14
14
|
s: 100,
|
|
15
15
|
l: 50
|
|
16
16
|
}; // Green
|
|
17
|
-
expect(convertColor.hslToHex(hsl2)).toBe(
|
|
17
|
+
expect(convertColor.hslToHex(hsl2)).toBe("00ff00");
|
|
18
18
|
const hsl3 = {
|
|
19
19
|
h: 240,
|
|
20
20
|
s: 100,
|
|
21
21
|
l: 50
|
|
22
22
|
}; // Blue
|
|
23
|
-
expect(convertColor.hslToHex(hsl3)).toBe(
|
|
23
|
+
expect(convertColor.hslToHex(hsl3)).toBe("0000ff");
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
-
describe(
|
|
27
|
-
it(
|
|
28
|
-
expect(convertColor.hexToHSL(
|
|
26
|
+
describe("hexToHSL", ()=>{
|
|
27
|
+
it("should convert 6-digit hex to HSL correctly", ()=>{
|
|
28
|
+
expect(convertColor.hexToHSL("#ff0000")).toEqual({
|
|
29
29
|
h: 0,
|
|
30
30
|
s: 100,
|
|
31
31
|
l: 50
|
|
32
32
|
});
|
|
33
|
-
expect(convertColor.hexToHSL(
|
|
33
|
+
expect(convertColor.hexToHSL("#00ff00")).toEqual({
|
|
34
34
|
h: 120,
|
|
35
35
|
s: 100,
|
|
36
36
|
l: 50
|
|
37
37
|
});
|
|
38
|
-
expect(convertColor.hexToHSL(
|
|
38
|
+
expect(convertColor.hexToHSL("#0000ff")).toEqual({
|
|
39
39
|
h: 240,
|
|
40
40
|
s: 100,
|
|
41
41
|
l: 50
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
it(
|
|
45
|
-
expect(convertColor.hexToHSL(
|
|
44
|
+
it("should convert 3-digit hex to HSL correctly", ()=>{
|
|
45
|
+
expect(convertColor.hexToHSL("#f00")).toEqual({
|
|
46
46
|
h: 0,
|
|
47
47
|
s: 100,
|
|
48
48
|
l: 50
|
|
49
49
|
});
|
|
50
|
-
expect(convertColor.hexToHSL(
|
|
50
|
+
expect(convertColor.hexToHSL("#0f0")).toEqual({
|
|
51
51
|
h: 120,
|
|
52
52
|
s: 100,
|
|
53
53
|
l: 50
|
|
54
54
|
});
|
|
55
|
-
expect(convertColor.hexToHSL(
|
|
55
|
+
expect(convertColor.hexToHSL("#00f")).toEqual({
|
|
56
56
|
h: 240,
|
|
57
57
|
s: 100,
|
|
58
58
|
l: 50
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
it(
|
|
62
|
-
expect(convertColor.hexToHSL(
|
|
63
|
-
expect(convertColor.hexToHSL(
|
|
64
|
-
expect(convertColor.hexToHSL(
|
|
61
|
+
it("should return undefined for invalid hex values", ()=>{
|
|
62
|
+
expect(convertColor.hexToHSL("#xyz")).toBeUndefined();
|
|
63
|
+
expect(convertColor.hexToHSL("#12")).toBeUndefined();
|
|
64
|
+
expect(convertColor.hexToHSL("invalid")).toBeUndefined();
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
-
describe(
|
|
68
|
-
it(
|
|
67
|
+
describe("RGBToHSL", ()=>{
|
|
68
|
+
it("should convert RGB to HSL correctly", ()=>{
|
|
69
69
|
expect(convertColor.RGBToHSL(255, 0, 0)).toEqual({
|
|
70
70
|
h: 0,
|
|
71
71
|
s: 100,
|
|
@@ -93,81 +93,81 @@ describe('convertColor', ()=>{
|
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
|
-
describe(
|
|
97
|
-
it(
|
|
96
|
+
describe("hslToRgb", ()=>{
|
|
97
|
+
it("should convert HSL to RGB correctly", ()=>{
|
|
98
98
|
expect(convertColor.hslToRgb(0, 100, 50)).toEqual({
|
|
99
|
-
r:
|
|
100
|
-
g:
|
|
101
|
-
b:
|
|
99
|
+
r: "ff",
|
|
100
|
+
g: "00",
|
|
101
|
+
b: "00"
|
|
102
102
|
});
|
|
103
103
|
expect(convertColor.hslToRgb(120, 100, 50)).toEqual({
|
|
104
|
-
r:
|
|
105
|
-
g:
|
|
106
|
-
b:
|
|
104
|
+
r: "00",
|
|
105
|
+
g: "ff",
|
|
106
|
+
b: "00"
|
|
107
107
|
});
|
|
108
108
|
expect(convertColor.hslToRgb(240, 100, 50)).toEqual({
|
|
109
|
-
r:
|
|
110
|
-
g:
|
|
111
|
-
b:
|
|
109
|
+
r: "00",
|
|
110
|
+
g: "00",
|
|
111
|
+
b: "ff"
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
-
describe(
|
|
117
|
-
it(
|
|
118
|
-
expect(checkColorType(
|
|
119
|
-
expect(checkColorType(
|
|
120
|
-
expect(checkColorType(
|
|
116
|
+
describe("checkColorType", ()=>{
|
|
117
|
+
it("should identify hex colors correctly", ()=>{
|
|
118
|
+
expect(checkColorType("#fff")).toBe("hex");
|
|
119
|
+
expect(checkColorType("#ffffff")).toBe("hex");
|
|
120
|
+
expect(checkColorType("#FF0000")).toBe("hex");
|
|
121
121
|
});
|
|
122
|
-
it(
|
|
123
|
-
expect(checkColorType(
|
|
124
|
-
expect(checkColorType(
|
|
122
|
+
it("should identify HSL colors correctly", ()=>{
|
|
123
|
+
expect(checkColorType("hsl(0, 100%, 50%)")).toBe("hsl");
|
|
124
|
+
expect(checkColorType("hsl(120, 60%, 70%)")).toBe("hsl");
|
|
125
125
|
});
|
|
126
|
-
it(
|
|
127
|
-
expect(checkColorType(
|
|
128
|
-
expect(checkColorType(
|
|
126
|
+
it("should identify RGB colors correctly", ()=>{
|
|
127
|
+
expect(checkColorType("rgb(255, 0, 0)")).toBe("rgb");
|
|
128
|
+
expect(checkColorType("rgb(255 0 0)")).toBe("rgb");
|
|
129
129
|
});
|
|
130
|
-
it(
|
|
131
|
-
expect(checkColorType(
|
|
132
|
-
expect(checkColorType(
|
|
133
|
-
expect(checkColorType(
|
|
130
|
+
it("should return null for invalid colors", ()=>{
|
|
131
|
+
expect(checkColorType("invalid")).toBeNull();
|
|
132
|
+
expect(checkColorType("rgb(300, 0, 0)")).toBeNull();
|
|
133
|
+
expect(checkColorType("hsl(400, 100%, 50%)")).toBeNull();
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
|
-
describe(
|
|
137
|
-
it(
|
|
138
|
-
expect(getHSLFromString(
|
|
136
|
+
describe("getHSLFromString", ()=>{
|
|
137
|
+
it("should parse valid HSL strings correctly", ()=>{
|
|
138
|
+
expect(getHSLFromString("hsl(0, 100%, 50%)")).toEqual({
|
|
139
139
|
h: 0,
|
|
140
140
|
s: 100,
|
|
141
141
|
l: 50
|
|
142
142
|
});
|
|
143
|
-
expect(getHSLFromString(
|
|
143
|
+
expect(getHSLFromString("hsl(120, 60%, 70%)")).toEqual({
|
|
144
144
|
h: 120,
|
|
145
145
|
s: 60,
|
|
146
146
|
l: 70
|
|
147
147
|
});
|
|
148
148
|
});
|
|
149
|
-
it(
|
|
150
|
-
expect(getHSLFromString(
|
|
151
|
-
expect(getHSLFromString(
|
|
152
|
-
expect(getHSLFromString(
|
|
149
|
+
it("should return null for invalid HSL strings", ()=>{
|
|
150
|
+
expect(getHSLFromString("invalid")).toBeNull();
|
|
151
|
+
expect(getHSLFromString("rgb(255, 0, 0)")).toBeNull();
|
|
152
|
+
expect(getHSLFromString("hsl(400, 100%, 50%")).toBeNull();
|
|
153
153
|
});
|
|
154
154
|
});
|
|
155
|
-
describe(
|
|
156
|
-
it(
|
|
155
|
+
describe("getStringFromHSL", ()=>{
|
|
156
|
+
it("should format HSL color object to string correctly", ()=>{
|
|
157
157
|
expect(getStringFromHSL({
|
|
158
158
|
h: 0,
|
|
159
159
|
s: 100,
|
|
160
160
|
l: 50
|
|
161
|
-
})).toBe(
|
|
161
|
+
})).toBe("hsl(0, 100%, 50%)");
|
|
162
162
|
expect(getStringFromHSL({
|
|
163
163
|
h: 120,
|
|
164
164
|
s: 60,
|
|
165
165
|
l: 70
|
|
166
|
-
})).toBe(
|
|
166
|
+
})).toBe("hsl(120, 60%, 70%)");
|
|
167
167
|
expect(getStringFromHSL({
|
|
168
168
|
h: 240,
|
|
169
169
|
s: 50,
|
|
170
170
|
l: 30
|
|
171
|
-
})).toBe(
|
|
171
|
+
})).toBe("hsl(240, 50%, 30%)");
|
|
172
172
|
});
|
|
173
173
|
});
|
package/dist/src/lib/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,MAAM;;;;;CAIlB,CAAC"}
|
package/dist/src/lib/config.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
const ENVS = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
apiUrl: process.env.NEXT_PUBLIC_API_URL,
|
|
3
|
+
webUrl: process.env.NEXT_PUBLIC_WEB_URL,
|
|
4
|
+
cronConfig: process.env.CRON_SECRET || "default-cron-secret-change-in-production"
|
|
4
5
|
};
|
|
5
6
|
const urls = {
|
|
6
|
-
api: new URL(ENVS.
|
|
7
|
-
web: new URL(ENVS.
|
|
7
|
+
api: new URL(ENVS.apiUrl ?? "http://localhost:3000"),
|
|
8
|
+
web: new URL(ENVS.webUrl ?? "http://localhost:3000")
|
|
8
9
|
};
|
|
9
10
|
export const CONFIG = {
|
|
10
|
-
node_development: process.env.NODE_ENV ===
|
|
11
|
-
...urls
|
|
11
|
+
node_development: process.env.NODE_ENV === "development",
|
|
12
|
+
...urls,
|
|
13
|
+
cronJobSecret: ENVS.cronConfig
|
|
12
14
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ctrl-or-command-character.d.ts","sourceRoot":"","sources":["../../../src/lib/ctrl-or-command-character.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,cAUlC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const CtrlOrCommandCharacter = ()=>{
|
|
3
|
+
const [key, setKey] = React.useState("⌘");
|
|
4
|
+
React.useEffect(()=>{
|
|
5
|
+
const isWindows = window.navigator.userAgent.includes("Windows");
|
|
6
|
+
if (isWindows) setKey("Ctrl");
|
|
7
|
+
}, []);
|
|
8
|
+
return key;
|
|
9
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-from-string-to-object.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/cookie-from-string-to-object.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GACnC,KAAK,MAAM,EAAE,KACZ;
|
|
1
|
+
{"version":3,"file":"cookie-from-string-to-object.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/cookie-from-string-to-object.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GACnC,KAAK,MAAM,EAAE,KACZ;IACD,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAC1D,MAAM,EAAE,OAAO,CAAC;CACjB,EAcA,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const cookieFromStringToObject = (str)=>{
|
|
2
|
-
return str.map((item)=>Object.fromEntries(item.split(
|
|
2
|
+
return str.map((item)=>Object.fromEntries(item.split("; ").map((v)=>{
|
|
3
3
|
const current = v.split(/=(.*)/s).map(decodeURIComponent);
|
|
4
4
|
if (current.length === 1) {
|
|
5
5
|
return [
|