@vitnode/core 1.2.0-canary.59 → 1.2.0-canary.61
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.js +15 -0
- package/dist/scripts/plugin.js +188 -0
- package/dist/scripts/prepare-database.js +177 -0
- package/dist/scripts/prepare-plugins-files.js +134 -0
- package/dist/scripts/run-interactive-shell-command.js +21 -0
- package/dist/scripts/scripts.js +39 -13
- package/dist/scripts/shared/file-utils.js +203 -0
- package/dist/src/api/adapters/sso/discord.js +1 -77
- package/dist/src/api/adapters/sso/facebook.js +1 -76
- package/dist/src/api/adapters/sso/google.js +1 -87
- package/dist/src/api/config.js +1 -67
- package/dist/src/api/lib/check-plugin-id.js +1 -43
- package/dist/src/api/lib/cron.js +1 -22
- package/dist/src/api/lib/logger-middleware.js +1 -35
- package/dist/src/api/lib/module.js +1 -22
- package/dist/src/api/lib/plugin.js +1 -22
- package/dist/src/api/lib/route.js +1 -27
- package/dist/src/api/lib/with-pagination.js +1 -83
- package/dist/src/api/middlewares/captcha.middleware.js +1 -63
- package/dist/src/api/middlewares/cron-auth.middleware.js +1 -19
- package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/global.middleware.js +1 -104
- package/dist/src/api/middlewares/rate-limiter.middleware.js +1 -32
- package/dist/src/api/models/device.js +1 -61
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +1 -77
- package/dist/src/api/models/password.js +1 -36
- package/dist/src/api/models/session-admin.d.ts.map +1 -1
- package/dist/src/api/models/session-admin.js +1 -97
- package/dist/src/api/models/session.d.ts.map +1 -1
- package/dist/src/api/models/session.js +1 -76
- package/dist/src/api/models/sso.js +1 -120
- package/dist/src/api/models/user/get-user-by-id.js +1 -19
- package/dist/src/api/models/user/sign-in-with-passwords.js +1 -22
- package/dist/src/api/models/user/sign-up.js +1 -73
- package/dist/src/api/models/user.js +1 -8
- package/dist/src/api/modules/admin/admin.module.js +1 -19
- package/dist/src/api/modules/admin/advanced/advanced.admin.module.js +1 -11
- package/dist/src/api/modules/admin/advanced/cron/cron.admin.module.js +1 -12
- package/dist/src/api/modules/admin/advanced/cron/routes/get.route.js +1 -66
- package/dist/src/api/modules/admin/advanced/cron/routes/run.route.js +1 -95
- package/dist/src/api/modules/admin/debug/debug.admin.module.js +1 -10
- package/dist/src/api/modules/admin/debug/routes/logs.route.js +1 -94
- package/dist/src/api/modules/admin/routes/session.route.js +1 -47
- package/dist/src/api/modules/admin/users/routes/list.route.js +1 -79
- package/dist/src/api/modules/admin/users/routes/users.route.js +1 -84
- package/dist/src/api/modules/admin/users/users.admin.module.js +1 -10
- package/dist/src/api/modules/cron/cron/clean.cron.js +1 -24
- package/dist/src/api/modules/cron/cron.module.js +1 -14
- package/dist/src/api/modules/cron/helpers/process-cron-jobs.d.ts.map +1 -1
- package/dist/src/api/modules/cron/helpers/process-cron-jobs.js +1 -72
- package/dist/src/api/modules/cron/routes/cron.route.d.ts.map +1 -1
- package/dist/src/api/modules/cron/routes/cron.route.js +1 -95
- package/dist/src/api/modules/middleware/middleware.module.js +1 -10
- package/dist/src/api/modules/middleware/route.js +1 -49
- package/dist/src/api/modules/users/avatar-color.js +1 -43
- package/dist/src/api/modules/users/routes/change-password.route.js +1 -58
- package/dist/src/api/modules/users/routes/reset-passowrd.route.js +1 -91
- package/dist/src/api/modules/users/routes/session.route.js +1 -46
- package/dist/src/api/modules/users/routes/sign-in.route.js +1 -71
- package/dist/src/api/modules/users/routes/sign-out.route.js +1 -43
- package/dist/src/api/modules/users/routes/sign-up.route.js +1 -77
- package/dist/src/api/modules/users/routes/test.route.js +1 -33
- package/dist/src/api/modules/users/sso/routes/callback.route.js +1 -52
- package/dist/src/api/modules/users/sso/routes/create-url.route.js +1 -36
- package/dist/src/api/modules/users/sso/sso.module.js +1 -12
- package/dist/src/api/modules/users/users.module.js +1 -26
- package/dist/src/api/plugin.js +1 -15
- package/dist/src/app/login/page.js +1 -16
- package/dist/src/app/login/reset-password/page.js +1 -18
- package/dist/src/app/login/sso/[providerId]/page.js +1 -10
- package/dist/src/app/register/page.js +1 -16
- package/dist/src/app_admin/core/advanced/cron/page.js +1 -42
- package/dist/src/app_admin/core/debug/page.js +1 -45
- package/dist/src/app_admin/core/page.js +1 -5
- package/dist/src/app_admin/core/test/page.js +1 -5
- package/dist/src/app_admin/core/users/page.js +1 -38
- package/dist/src/components/avatar.js +1 -14
- package/dist/src/components/confirm-action/confirm-action-alert-dialog.js +1 -42
- package/dist/src/components/confirm-action/content.js +1 -31
- package/dist/src/components/date-format.js +1 -41
- package/dist/src/components/form/auto-form.js +1 -103
- package/dist/src/components/form/common/desc.js +1 -9
- package/dist/src/components/form/common/label.js +1 -18
- package/dist/src/components/form/fields/checkbox.js +1 -37
- package/dist/src/components/form/fields/combobox-async.js +1 -123
- package/dist/src/components/form/fields/combobox.js +1 -87
- package/dist/src/components/form/fields/input.js +1 -39
- package/dist/src/components/form/fields/radio-group.js +1 -50
- package/dist/src/components/form/fields/select.js +1 -58
- package/dist/src/components/form/fields/switch.js +1 -36
- package/dist/src/components/form/fields/textarea.js +1 -36
- package/dist/src/components/i18n-provider.js +1 -43
- package/dist/src/components/logo-vitnode.js +1 -119
- package/dist/src/components/switchers/langs/language-switcher.js +1 -47
- package/dist/src/components/switchers/themes/theme-switcher.js +1 -28
- package/dist/src/components/table/content.js +1 -81
- package/dist/src/components/table/data-table.js +1 -68
- package/dist/src/components/table/order-table-head.js +1 -50
- package/dist/src/components/table/pagination.js +1 -122
- package/dist/src/components/tiptap/extension.js +1 -33
- package/dist/src/components/tiptap/toolbar/actions/alignment-action.js +1 -91
- package/dist/src/components/tiptap/toolbar/actions/bold-action.js +1 -39
- package/dist/src/components/tiptap/toolbar/actions/headings-action.js +1 -93
- package/dist/src/components/tiptap/toolbar/actions/italic-action.js +1 -38
- package/dist/src/components/tiptap/toolbar/actions/list-action.js +1 -61
- package/dist/src/components/tiptap/toolbar/actions/text-format-more/text-format-more.js +1 -59
- package/dist/src/components/tiptap/toolbar/actions/underline-action.js +1 -38
- package/dist/src/components/tiptap/toolbar/actions/undo-redo-actions.js +1 -63
- package/dist/src/components/tiptap/toolbar/actions/utils/tooltip-shortcut.js +1 -11
- package/dist/src/components/tiptap/toolbar/tiptap-toolbar.js +1 -55
- package/dist/src/components/tiptap/toolbar/use-toolbar-editor.js +1 -5
- package/dist/src/components/ui/accordion.js +1 -46
- package/dist/src/components/ui/alert-dialog.js +1 -123
- package/dist/src/components/ui/alert.js +1 -39
- package/dist/src/components/ui/badge.js +1 -28
- package/dist/src/components/ui/button-client.js +1 -57
- package/dist/src/components/ui/button.js +1 -32
- package/dist/src/components/ui/card.js +1 -52
- package/dist/src/components/ui/checkbox.js +1 -20
- package/dist/src/components/ui/collapsible.js +1 -22
- package/dist/src/components/ui/command.js +1 -98
- package/dist/src/components/ui/context-menu.js +1 -140
- package/dist/src/components/ui/dialog.js +1 -189
- package/dist/src/components/ui/drawer.js +1 -83
- package/dist/src/components/ui/dropdown-menu.js +1 -141
- package/dist/src/components/ui/editor-content.js +1 -10
- package/dist/src/components/ui/editor.js +1 -35
- package/dist/src/components/ui/form.js +1 -148
- package/dist/src/components/ui/header-content.js +1 -30
- package/dist/src/components/ui/hover-card.js +1 -29
- package/dist/src/components/ui/input-otp.js +1 -48
- package/dist/src/components/ui/input.js +1 -11
- package/dist/src/components/ui/label.js +1 -12
- package/dist/src/components/ui/loader.js +1 -16
- package/dist/src/components/ui/menubar.js +1 -151
- package/dist/src/components/ui/navigation-menu.js +1 -82
- package/dist/src/components/ui/popover.js +1 -35
- package/dist/src/components/ui/progress.js +1 -19
- package/dist/src/components/ui/radio-group.js +1 -27
- package/dist/src/components/ui/scroll-area.js +1 -33
- package/dist/src/components/ui/select.js +1 -113
- package/dist/src/components/ui/separator.js +1 -14
- package/dist/src/components/ui/sheet.js +1 -92
- package/dist/src/components/ui/sidebar.js +1 -433
- package/dist/src/components/ui/skeleton.js +1 -10
- package/dist/src/components/ui/slider.js +1 -50
- package/dist/src/components/ui/sonner.js +1 -26
- package/dist/src/components/ui/switch.js +1 -16
- package/dist/src/components/ui/table.js +1 -63
- package/dist/src/components/ui/tabs.js +1 -33
- package/dist/src/components/ui/textarea.js +1 -10
- package/dist/src/components/ui/toggle-group.js +1 -45
- package/dist/src/components/ui/toggle.js +1 -34
- package/dist/src/components/ui/tooltip.js +1 -57
- package/dist/src/config.js +1 -4
- package/dist/src/database/admins.js +1 -74
- package/dist/src/database/cron.js +1 -22
- package/dist/src/database/languages.js +1 -52
- package/dist/src/database/logs.js +1 -34
- package/dist/src/database/moderators.js +1 -37
- package/dist/src/database/roles.js +1 -13
- package/dist/src/database/sessions.js +1 -60
- package/dist/src/database/users.js +1 -145
- package/dist/src/drizzle.config.js +1 -67
- package/dist/src/emails/default-template.js +1 -99
- package/dist/src/emails/reset-password.js +1 -132
- package/dist/src/emails/ui/button.js +1 -36
- package/dist/src/emails/ui/card.js +1 -39
- package/dist/src/hooks/use-before-unload.js +1 -30
- package/dist/src/hooks/use-captcha.js +1 -122
- package/dist/src/hooks/use-mobile.js +1 -16
- package/dist/src/lib/api/get-middleware-api.js +1 -13
- package/dist/src/lib/api/get-next-cron-run-date.js +1 -14
- package/dist/src/lib/api/get-next-cron-run-date.test.js +1 -55
- package/dist/src/lib/api/get-session-admin-api.js +1 -19
- package/dist/src/lib/api/get-session-api.js +1 -14
- package/dist/src/lib/api/should-cron-job-run.js +1 -16
- package/dist/src/lib/api/should-cron-job-run.test.js +1 -213
- package/dist/src/lib/api/validate-cron-schedule.d.ts +2 -0
- package/dist/src/lib/api/validate-cron-schedule.d.ts.map +1 -0
- package/dist/src/lib/api/validate-cron-schedule.js +1 -0
- package/dist/src/lib/api/validate-cron-schedule.test.d.ts +2 -0
- package/dist/src/lib/api/validate-cron-schedule.test.d.ts.map +1 -0
- package/dist/src/lib/api/validate-cron-schedule.test.js +1 -0
- package/dist/src/lib/colors.js +1 -140
- package/dist/src/lib/colors.test.js +1 -173
- package/dist/src/lib/config.js +1 -14
- package/dist/src/lib/ctrl-or-command-character.js +1 -5
- package/dist/src/lib/fetcher/cookie-from-string-to-object.js +1 -12
- package/dist/src/lib/fetcher/cookie-from-string-to-object.test.js +1 -78
- package/dist/src/lib/fetcher/core.js +3 -48
- package/dist/src/lib/fetcher/helpers-server.js +1 -18
- package/dist/src/lib/fetcher/helpers.js +1 -16
- package/dist/src/lib/fetcher/helpers.test.js +1 -37
- package/dist/src/lib/fetcher/types.js +1 -1
- package/dist/src/lib/fetcher-client.js +1 -17
- package/dist/src/lib/fetcher.js +1 -33
- package/dist/src/lib/helpers/auto-form.js +1 -98
- package/dist/src/lib/helpers/auto-form.test.js +1 -336
- package/dist/src/lib/navigation.d.ts +15 -13
- package/dist/src/lib/navigation.d.ts.map +1 -1
- package/dist/src/lib/navigation.js +1 -11
- package/dist/src/lib/plugin.js +1 -3
- package/dist/src/lib/special-characters.js +1 -4
- package/dist/src/lib/special-characters.test.js +1 -56
- package/dist/src/lib/utils.js +1 -5
- package/dist/src/locales/en.json +308 -0
- package/dist/src/tests/setup.js +1 -6
- package/dist/src/views/admin/layouts/admin-layout.js +1 -73
- package/dist/src/views/admin/layouts/sidebar/nav/item.js +1 -98
- package/dist/src/views/admin/layouts/sidebar/nav/nav.js +1 -60
- package/dist/src/views/admin/layouts/sidebar/sidebar.js +1 -28
- package/dist/src/views/admin/layouts/sidebar/sign-out.js +1 -14
- package/dist/src/views/admin/layouts/user-bar/client.js +1 -69
- package/dist/src/views/admin/layouts/user-bar/user-bar.js +1 -32
- package/dist/src/views/admin/sign-in/sign-in-admin-view.js +1 -27
- package/dist/src/views/admin/views/core/advanced/cron/cron-table-view.js +1 -97
- package/dist/src/views/admin/views/core/advanced/cron/run-action/mutation-api.js +1 -23
- package/dist/src/views/admin/views/core/advanced/cron/run-action/run-action.js +1 -38
- package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.js +1 -44
- package/dist/src/views/admin/views/core/debug/actions/clear-cache/clear-cache.js +1 -35
- package/dist/src/views/admin/views/core/debug/actions/clear-cache/mutation-api.js +1 -5
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.js +1 -281
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.js +1 -67
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.js +1 -14
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.js +1 -30
- package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.js +1 -96
- package/dist/src/views/admin/views/core/test.js +1 -161
- package/dist/src/views/admin/views/core/users/users-admin-view.js +1 -89
- package/dist/src/views/auth/password-reset/change-password-form/form.js +1 -48
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +1 -22
- package/dist/src/views/auth/password-reset/change-password-form/use-form.js +1 -36
- package/dist/src/views/auth/password-reset/form/form.js +1 -104
- package/dist/src/views/auth/password-reset/form/mutation-api.js +1 -21
- package/dist/src/views/auth/password-reset/form/use-form.js +1 -33
- package/dist/src/views/auth/password-reset/password-reset-view.js +1 -37
- package/dist/src/views/auth/sign-in/form/form.js +1 -64
- package/dist/src/views/auth/sign-in/form/mutation-api.js +1 -33
- package/dist/src/views/auth/sign-in/form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/use-form.js +1 -38
- package/dist/src/views/auth/sign-in/sign-in-view.js +1 -61
- package/dist/src/views/auth/sign-up/components/password-input.js +1 -96
- package/dist/src/views/auth/sign-up/email-confirmation-view.js +1 -55
- package/dist/src/views/auth/sign-up/form/form.js +1 -89
- package/dist/src/views/auth/sign-up/form/mutation-api.js +1 -30
- package/dist/src/views/auth/sign-up/form/use-form.js +1 -70
- package/dist/src/views/auth/sign-up/sign-up-view.js +1 -65
- package/dist/src/views/auth/sign-up/wrapper.js +1 -22
- package/dist/src/views/auth/sso/buttons/client.js +1 -22
- package/dist/src/views/auth/sso/buttons/mutation-api.js +1 -24
- package/dist/src/views/auth/sso/buttons/sso-buttons.js +1 -56
- package/dist/src/views/auth/sso/callback/callback-sso-view.js +1 -32
- package/dist/src/views/auth/sso/callback/client/client.js +1 -68
- package/dist/src/views/auth/sso/callback/client/mutation-api.js +1 -32
- package/dist/src/views/error/back-button.js +1 -14
- package/dist/src/views/error/error-view.js +1 -58
- package/dist/src/views/error/global-error-view.js +1 -50
- package/dist/src/views/layouts/provider.js +1 -44
- package/dist/src/views/layouts/root-layout.js +1 -25
- package/dist/src/views/layouts/theme/header/header.js +1 -38
- package/dist/src/views/layouts/theme/header/user/auth/auth.js +1 -33
- package/dist/src/views/layouts/theme/header/user/auth/client.js +1 -47
- package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.js +1 -27
- package/dist/src/views/layouts/theme/header/user/user.js +1 -32
- package/dist/src/views/layouts/theme/layout.js +1 -16
- package/dist/src/vitnode.config.d.ts.map +1 -1
- package/dist/src/vitnode.config.js +1 -42
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsup.config.js +18 -0
- package/dist/vitest.config.d.ts.map +1 -1
- package/dist/vitest.config.js +49 -0
- package/eslint.config.mjs +2 -0
- package/package.json +40 -44
- package/dist/src/api/adapters/cron/node-cron.adapter.d.ts +0 -3
- package/dist/src/api/adapters/cron/node-cron.adapter.d.ts.map +0 -1
- package/dist/src/api/adapters/cron/node-cron.adapter.js +0 -11
- package/dist/src/api/adapters/email/nodemailer.d.ts +0 -10
- package/dist/src/api/adapters/email/nodemailer.d.ts.map +0 -1
- package/dist/src/api/adapters/email/nodemailer.js +0 -30
- package/dist/src/api/adapters/email/resend.d.ts +0 -6
- package/dist/src/api/adapters/email/resend.d.ts.map +0 -1
- package/dist/src/api/adapters/email/resend.js +0 -21
|
@@ -1,77 +1 @@
|
|
|
1
|
-
import { z }
|
|
2
|
-
import { buildRoute } from "../../../lib/route.js";
|
|
3
|
-
import { PasswordModel } from "../../../models/password.js";
|
|
4
|
-
import { UserModel } from "../../../models/user.js";
|
|
5
|
-
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
6
|
-
import { SessionModel } from "../../../models/session.js";
|
|
7
|
-
const nameRegex = /^(?!.* {2})[\p{L}\p{N}._@ -]*$/u;
|
|
8
|
-
export const zodSignUpSchema = z.object({
|
|
9
|
-
email: z.email().toLowerCase().openapi({
|
|
10
|
-
example: "test@test.com"
|
|
11
|
-
}),
|
|
12
|
-
name: z.string().openapi({
|
|
13
|
-
example: "test"
|
|
14
|
-
}).min(3).refine((val)=>nameRegex.test(val), {
|
|
15
|
-
message: "Invalid name"
|
|
16
|
-
}),
|
|
17
|
-
password: z.string().min(8).openapi({
|
|
18
|
-
example: "Test123!"
|
|
19
|
-
}),
|
|
20
|
-
newsletter: z.boolean().default(false).optional()
|
|
21
|
-
});
|
|
22
|
-
export const signUpRoute = buildRoute({
|
|
23
|
-
pluginId: CONFIG_PLUGIN.pluginId,
|
|
24
|
-
route: {
|
|
25
|
-
method: "post",
|
|
26
|
-
description: "Create a new user",
|
|
27
|
-
path: "/sign_up",
|
|
28
|
-
withCaptcha: true,
|
|
29
|
-
request: {
|
|
30
|
-
body: {
|
|
31
|
-
required: true,
|
|
32
|
-
content: {
|
|
33
|
-
"application/json": {
|
|
34
|
-
schema: zodSignUpSchema
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
responses: {
|
|
40
|
-
201: {
|
|
41
|
-
content: {
|
|
42
|
-
"application/json": {
|
|
43
|
-
schema: z.object({
|
|
44
|
-
id: z.number(),
|
|
45
|
-
emailVerified: z.boolean(),
|
|
46
|
-
email: z.email()
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
description: "User created"
|
|
51
|
-
},
|
|
52
|
-
400: {
|
|
53
|
-
description: "Bad Request"
|
|
54
|
-
},
|
|
55
|
-
409: {
|
|
56
|
-
description: "Email or name already exists"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
handler: async (c)=>{
|
|
61
|
-
const hashedPassword = await new PasswordModel().encryptPassword(c.req.valid("json").password);
|
|
62
|
-
const data = await new UserModel().signUp({
|
|
63
|
-
...c.req.valid("json"),
|
|
64
|
-
hashedPassword
|
|
65
|
-
}, c);
|
|
66
|
-
if (data.emailVerified) {
|
|
67
|
-
await new SessionModel(c).createSessionByUserId(data.id);
|
|
68
|
-
} else {
|
|
69
|
-
// TODO: Send verification email
|
|
70
|
-
}
|
|
71
|
-
return c.json({
|
|
72
|
-
id: data.id,
|
|
73
|
-
emailVerified: data.emailVerified,
|
|
74
|
-
email: data.email
|
|
75
|
-
}, 201);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
1
|
+
import{z}from"zod";import{buildRoute}from"../../../lib/route.js";import{PasswordModel}from"../../../models/password.js";import{UserModel}from"../../../models/user.js";import{CONFIG_PLUGIN}from"../../../../config.js";import{SessionModel}from"../../../models/session.js";const nameRegex=/^(?!.* {2})[\p{L}\p{N}._@ -]*$/u;export const zodSignUpSchema=z.object({email:z.email().toLowerCase().openapi({example:"test@test.com"}),name:z.string().openapi({example:"test"}).min(3).refine(val=>nameRegex.test(val),{message:"Invalid name"}),password:z.string().min(8).openapi({example:"Test123!"}),newsletter:z.boolean().default(false).optional()});export const signUpRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,route:{method:"post",description:"Create a new user",path:"/sign_up",withCaptcha:true,request:{body:{required:true,content:{"application/json":{schema:zodSignUpSchema}}}},responses:{201:{content:{"application/json":{schema:z.object({id:z.number(),emailVerified:z.boolean(),email:z.email()})}},description:"User created"},400:{description:"Bad Request"},409:{description:"Email or name already exists"}}},handler:async c=>{const hashedPassword=await new PasswordModel().encryptPassword(c.req.valid("json").password);const data=await new UserModel().signUp({...c.req.valid("json"),hashedPassword},c);if(data.emailVerified){await new SessionModel(c).createSessionByUserId(data.id)}else{}return c.json({id:data.id,emailVerified:data.emailVerified,email:data.email},201)}});
|
|
@@ -1,33 +1 @@
|
|
|
1
|
-
import { z
|
|
2
|
-
import { buildRoute } from "../../../lib/route.js";
|
|
3
|
-
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
4
|
-
export const testRoute = buildRoute({
|
|
5
|
-
pluginId: CONFIG_PLUGIN.pluginId,
|
|
6
|
-
route: {
|
|
7
|
-
method: "post",
|
|
8
|
-
description: "Test route",
|
|
9
|
-
path: "/test",
|
|
10
|
-
responses: {
|
|
11
|
-
200: {
|
|
12
|
-
content: {
|
|
13
|
-
"text/plain": {
|
|
14
|
-
schema: z.string()
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
description: "User"
|
|
18
|
-
},
|
|
19
|
-
201: {
|
|
20
|
-
content: {
|
|
21
|
-
"text/plain": {
|
|
22
|
-
schema: z.string()
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
description: "User"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
handler: async (c)=>{
|
|
30
|
-
await c.get("log").warn("This is a test warn log");
|
|
31
|
-
return c.text("test");
|
|
32
|
-
}
|
|
33
|
-
});
|
|
1
|
+
import{z}from"zod";import{buildRoute}from"../../../lib/route.js";import{CONFIG_PLUGIN}from"../../../../config.js";export const testRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,route:{method:"post",description:"Test route",path:"/test",responses:{200:{content:{"text/plain":{schema:z.string()}},description:"User"},201:{content:{"text/plain":{schema:z.string()}},description:"User"}}},handler:async c=>{await c.get("log").warn("This is a test warn log");return c.text("test")}});
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
import { z
|
|
2
|
-
import { buildRoute } from "../../../../lib/route.js";
|
|
3
|
-
import { SessionModel } from "../../../../models/session.js";
|
|
4
|
-
import { SSOModel } from "../../../../models/sso.js";
|
|
5
|
-
import { CONFIG_PLUGIN } from "../../../../../config.js";
|
|
6
|
-
export const callbackRoute = buildRoute({
|
|
7
|
-
pluginId: CONFIG_PLUGIN.pluginId,
|
|
8
|
-
route: {
|
|
9
|
-
method: "get",
|
|
10
|
-
description: "SSO Callback",
|
|
11
|
-
path: "/{providerId}/callback",
|
|
12
|
-
request: {
|
|
13
|
-
params: z.object({
|
|
14
|
-
providerId: z.string()
|
|
15
|
-
}),
|
|
16
|
-
query: z.object({
|
|
17
|
-
code: z.string(),
|
|
18
|
-
state: z.string()
|
|
19
|
-
})
|
|
20
|
-
},
|
|
21
|
-
responses: {
|
|
22
|
-
200: {
|
|
23
|
-
content: {
|
|
24
|
-
"application/json": {
|
|
25
|
-
schema: z.object({
|
|
26
|
-
id: z.number(),
|
|
27
|
-
token: z.string()
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
description: "URL"
|
|
32
|
-
},
|
|
33
|
-
409: {
|
|
34
|
-
description: "Email already exists"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
handler: async (c)=>{
|
|
39
|
-
const { providerId } = c.req.valid("param");
|
|
40
|
-
const { code, state } = c.req.valid("query");
|
|
41
|
-
const sso = await new SSOModel(c).callback({
|
|
42
|
-
providerId,
|
|
43
|
-
code,
|
|
44
|
-
state
|
|
45
|
-
});
|
|
46
|
-
const { token } = await new SessionModel(c).createSessionByUserId(sso.userId);
|
|
47
|
-
return c.json({
|
|
48
|
-
id: sso.userId,
|
|
49
|
-
token
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
});
|
|
1
|
+
import{z}from"zod";import{buildRoute}from"../../../../lib/route.js";import{SessionModel}from"../../../../models/session.js";import{SSOModel}from"../../../../models/sso.js";import{CONFIG_PLUGIN}from"../../../../../config.js";export const callbackRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,route:{method:"get",description:"SSO Callback",path:"/{providerId}/callback",request:{params:z.object({providerId:z.string()}),query:z.object({code:z.string(),state:z.string()})},responses:{200:{content:{"application/json":{schema:z.object({id:z.number(),token:z.string()})}},description:"URL"},409:{description:"Email already exists"}}},handler:async c=>{const{providerId}=c.req.valid("param");const{code,state}=c.req.valid("query");const sso=await new SSOModel(c).callback({providerId,code,state});const{token}=await new SessionModel(c).createSessionByUserId(sso.userId);return c.json({id:sso.userId,token})}});
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
import { z }
|
|
2
|
-
import { buildRoute } from "../../../../lib/route.js";
|
|
3
|
-
import { SSOModel } from "../../../../models/sso.js";
|
|
4
|
-
import { CONFIG_PLUGIN } from "../../../../../config.js";
|
|
5
|
-
export const createUrlRoute = buildRoute({
|
|
6
|
-
pluginId: CONFIG_PLUGIN.pluginId,
|
|
7
|
-
route: {
|
|
8
|
-
method: "post",
|
|
9
|
-
description: "Generate SSO URL",
|
|
10
|
-
path: "/{providerId}",
|
|
11
|
-
request: {
|
|
12
|
-
params: z.object({
|
|
13
|
-
providerId: z.string()
|
|
14
|
-
})
|
|
15
|
-
},
|
|
16
|
-
responses: {
|
|
17
|
-
200: {
|
|
18
|
-
content: {
|
|
19
|
-
"application/json": {
|
|
20
|
-
schema: z.object({
|
|
21
|
-
url: z.string()
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
description: "URL"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
handler: async (c)=>{
|
|
30
|
-
const { providerId } = c.req.valid("param");
|
|
31
|
-
const url = await new SSOModel(c).getUrl(providerId);
|
|
32
|
-
return c.json({
|
|
33
|
-
url
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
1
|
+
import{z}from"zod";import{buildRoute}from"../../../../lib/route.js";import{SSOModel}from"../../../../models/sso.js";import{CONFIG_PLUGIN}from"../../../../../config.js";export const createUrlRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,route:{method:"post",description:"Generate SSO URL",path:"/{providerId}",request:{params:z.object({providerId:z.string()})},responses:{200:{content:{"application/json":{schema:z.object({url:z.string()})}},description:"URL"}}},handler:async c=>{const{providerId}=c.req.valid("param");const url=await new SSOModel(c).getUrl(providerId);return c.json({url})}});
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
3
|
-
import { callbackRoute } from "./routes/callback.route.js";
|
|
4
|
-
import { createUrlRoute } from "./routes/create-url.route.js";
|
|
5
|
-
export const ssoUserModule = buildModule({
|
|
6
|
-
pluginId: CONFIG_PLUGIN.pluginId,
|
|
7
|
-
name: "sso",
|
|
8
|
-
routes: [
|
|
9
|
-
callbackRoute,
|
|
10
|
-
createUrlRoute
|
|
11
|
-
]
|
|
12
|
-
});
|
|
1
|
+
import{buildModule}from"../../../lib/module.js";import{CONFIG_PLUGIN}from"../../../../config.js";import{callbackRoute}from"./routes/callback.route.js";import{createUrlRoute}from"./routes/create-url.route.js";export const ssoUserModule=buildModule({pluginId:CONFIG_PLUGIN.pluginId,name:"sso",routes:[callbackRoute,createUrlRoute]});
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CONFIG_PLUGIN } from "../../../config.js";
|
|
3
|
-
import { changePasswordRoute } from "./routes/change-password.route.js";
|
|
4
|
-
import { resetPasswordRoute } from "./routes/reset-passowrd.route.js";
|
|
5
|
-
import { sessionRoute } from "./routes/session.route.js";
|
|
6
|
-
import { signInRoute } from "./routes/sign-in.route.js";
|
|
7
|
-
import { signOutRoute } from "./routes/sign-out.route.js";
|
|
8
|
-
import { signUpRoute } from "./routes/sign-up.route.js";
|
|
9
|
-
import { testRoute } from "./routes/test.route.js";
|
|
10
|
-
import { ssoUserModule } from "./sso/sso.module.js";
|
|
11
|
-
export const usersModule = buildModule({
|
|
12
|
-
pluginId: CONFIG_PLUGIN.pluginId,
|
|
13
|
-
name: "users",
|
|
14
|
-
routes: [
|
|
15
|
-
sessionRoute,
|
|
16
|
-
signInRoute,
|
|
17
|
-
signOutRoute,
|
|
18
|
-
signUpRoute,
|
|
19
|
-
testRoute,
|
|
20
|
-
resetPasswordRoute,
|
|
21
|
-
changePasswordRoute
|
|
22
|
-
],
|
|
23
|
-
modules: [
|
|
24
|
-
ssoUserModule
|
|
25
|
-
]
|
|
26
|
-
});
|
|
1
|
+
import{buildModule}from"../../lib/module.js";import{CONFIG_PLUGIN}from"../../../config.js";import{changePasswordRoute}from"./routes/change-password.route.js";import{resetPasswordRoute}from"./routes/reset-passowrd.route.js";import{sessionRoute}from"./routes/session.route.js";import{signInRoute}from"./routes/sign-in.route.js";import{signOutRoute}from"./routes/sign-out.route.js";import{signUpRoute}from"./routes/sign-up.route.js";import{testRoute}from"./routes/test.route.js";import{ssoUserModule}from"./sso/sso.module.js";export const usersModule=buildModule({pluginId:CONFIG_PLUGIN.pluginId,name:"users",routes:[sessionRoute,signInRoute,signOutRoute,signUpRoute,testRoute,resetPasswordRoute,changePasswordRoute],modules:[ssoUserModule]});
|
package/dist/src/api/plugin.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { buildApiPlugin } from "./lib/plugin.js";
|
|
3
|
-
import { adminModule } from "./modules/admin/admin.module.js";
|
|
4
|
-
import { cronModule } from "./modules/cron/cron.module.js";
|
|
5
|
-
import { middlewareModule } from "./modules/middleware/middleware.module.js";
|
|
6
|
-
import { usersModule } from "./modules/users/users.module.js";
|
|
7
|
-
export const newBuildPluginApiCore = buildApiPlugin({
|
|
8
|
-
pluginId: CONFIG_PLUGIN.pluginId,
|
|
9
|
-
modules: [
|
|
10
|
-
middlewareModule,
|
|
11
|
-
usersModule,
|
|
12
|
-
adminModule,
|
|
13
|
-
cronModule
|
|
14
|
-
]
|
|
15
|
-
});
|
|
1
|
+
import{CONFIG_PLUGIN}from"../config.js";import{buildApiPlugin}from"./lib/plugin.js";import{adminModule}from"./modules/admin/admin.module.js";import{cronModule}from"./modules/cron/cron.module.js";import{middlewareModule}from"./modules/middleware/middleware.module.js";import{usersModule}from"./modules/users/users.module.js";export const newBuildPluginApiCore=buildApiPlugin({pluginId:CONFIG_PLUGIN.pluginId,modules:[middlewareModule,usersModule,adminModule,cronModule]});
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getTranslations } from "next-intl/server";
|
|
3
|
-
import { SignInView } from "../../views/auth/sign-in/sign-in-view.js";
|
|
4
|
-
export const generateMetadata = async ({ params })=>{
|
|
5
|
-
const { locale } = await params;
|
|
6
|
-
const t = await getTranslations({
|
|
7
|
-
locale,
|
|
8
|
-
namespace: "core.global"
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
title: t("login")
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export default function Page() {
|
|
15
|
-
return /*#__PURE__*/ _jsx(SignInView, {});
|
|
16
|
-
}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{getTranslations}from"next-intl/server";import{SignInView}from"../../views/auth/sign-in/sign-in-view.js";export const generateMetadata=async({params})=>{const{locale}=await params;const t=await getTranslations({locale,namespace:"core.global"});return{title:t("login")}};export default function Page(){return _jsx(SignInView,{})}
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getTranslations } from "next-intl/server";
|
|
3
|
-
import { PasswordResetView } from "../../../views/auth/password-reset/password-reset-view.js";
|
|
4
|
-
export const generateMetadata = async ({ params })=>{
|
|
5
|
-
const { locale } = await params;
|
|
6
|
-
const t = await getTranslations({
|
|
7
|
-
locale,
|
|
8
|
-
namespace: "core.auth.reset_password"
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
title: t("title")
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export default function Page(props) {
|
|
15
|
-
return /*#__PURE__*/ _jsx(PasswordResetView, {
|
|
16
|
-
...props
|
|
17
|
-
});
|
|
18
|
-
}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{getTranslations}from"next-intl/server";import{PasswordResetView}from"../../../views/auth/password-reset/password-reset-view.js";export const generateMetadata=async({params})=>{const{locale}=await params;const t=await getTranslations({locale,namespace:"core.auth.reset_password"});return{title:t("title")}};export default function Page(props){return _jsx(PasswordResetView,{...props})}
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CallbackSSOView } from "../../../../views/auth/sso/callback/callback-sso-view.js";
|
|
3
|
-
export default async function Page({ params, searchParams }) {
|
|
4
|
-
const { providerId } = await params;
|
|
5
|
-
const currentSearchParams = await searchParams;
|
|
6
|
-
return /*#__PURE__*/ _jsx(CallbackSSOView, {
|
|
7
|
-
providerId: providerId,
|
|
8
|
-
searchParams: currentSearchParams
|
|
9
|
-
});
|
|
10
|
-
}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{CallbackSSOView}from"../../../../views/auth/sso/callback/callback-sso-view.js";export default async function Page({params,searchParams}){const{providerId}=await params;const currentSearchParams=await searchParams;return _jsx(CallbackSSOView,{providerId:providerId,searchParams:currentSearchParams})}
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getTranslations } from "next-intl/server";
|
|
3
|
-
import { SignUpView } from "../../views/auth/sign-up/sign-up-view.js";
|
|
4
|
-
export const generateMetadata = async ({ params })=>{
|
|
5
|
-
const { locale } = await params;
|
|
6
|
-
const t = await getTranslations({
|
|
7
|
-
locale,
|
|
8
|
-
namespace: "core.global"
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
title: t("register")
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export default function Page() {
|
|
15
|
-
return /*#__PURE__*/ _jsx(SignUpView, {});
|
|
16
|
-
}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{getTranslations}from"next-intl/server";import{SignUpView}from"../../views/auth/sign-up/sign-up-view.js";export const generateMetadata=async({params})=>{const{locale}=await params;const t=await getTranslations({locale,namespace:"core.global"});return{title:t("register")}};export default function Page(){return _jsx(SignUpView,{})}
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getTranslations } from "next-intl/server";
|
|
3
|
-
import dynamic from "next/dynamic";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { I18nProvider } from "../../../../components/i18n-provider.js";
|
|
6
|
-
import { DataTableSkeleton } from "../../../../components/table/data-table.js";
|
|
7
|
-
import { HeaderContent } from "../../../../components/ui/header-content.js";
|
|
8
|
-
const CronTableView = dynamic(async ()=>import("../../../../views/admin/views/core/advanced/cron/cron-table-view.js").then((module)=>({
|
|
9
|
-
default: module.CronTableView
|
|
10
|
-
})));
|
|
11
|
-
export const generateMetadata = async ()=>{
|
|
12
|
-
const t = await getTranslations("admin.advanced.cron");
|
|
13
|
-
return {
|
|
14
|
-
title: t("title"),
|
|
15
|
-
description: t("desc")
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export default async function Page(props) {
|
|
19
|
-
const t = await getTranslations("admin.advanced.cron");
|
|
20
|
-
return /*#__PURE__*/ _jsx(I18nProvider, {
|
|
21
|
-
namespaces: [
|
|
22
|
-
"admin.advanced.cron"
|
|
23
|
-
],
|
|
24
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
25
|
-
className: "p-4",
|
|
26
|
-
children: [
|
|
27
|
-
/*#__PURE__*/ _jsx(HeaderContent, {
|
|
28
|
-
desc: t("desc"),
|
|
29
|
-
h1: t("title")
|
|
30
|
-
}),
|
|
31
|
-
/*#__PURE__*/ _jsx(React.Suspense, {
|
|
32
|
-
fallback: /*#__PURE__*/ _jsx(DataTableSkeleton, {
|
|
33
|
-
columns: 6
|
|
34
|
-
}),
|
|
35
|
-
children: /*#__PURE__*/ _jsx(CronTableView, {
|
|
36
|
-
...props
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
]
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
}
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{getTranslations}from"next-intl/server";import dynamic from"next/dynamic";import React from"react";import{I18nProvider}from"../../../../components/i18n-provider.js";import{DataTableSkeleton}from"../../../../components/table/data-table.js";import{HeaderContent}from"../../../../components/ui/header-content.js";const CronTableView=dynamic(async()=>import("../../../../views/admin/views/core/advanced/cron/cron-table-view.js").then(module=>({default:module.CronTableView})));export const generateMetadata=async()=>{const t=await getTranslations("admin.advanced.cron");return{title:t("title"),description:t("desc")}};export default async function Page(props){const t=await getTranslations("admin.advanced.cron");return _jsx(I18nProvider,{namespaces:["admin.advanced.cron"],children:_jsxs("div",{className:"p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:t("title")}),_jsx(React.Suspense,{fallback:_jsx(DataTableSkeleton,{columns:6}),children:_jsx(CronTableView,{...props})})]})})}
|
|
@@ -1,45 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getTranslations } from "next-intl/server";
|
|
3
|
-
import dynamic from "next/dynamic";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { I18nProvider } from "../../../components/i18n-provider.js";
|
|
6
|
-
import { DataTableSkeleton } from "../../../components/table/data-table.js";
|
|
7
|
-
import { HeaderContent } from "../../../components/ui/header-content.js";
|
|
8
|
-
import { ClearCacheAction } from "../../../views/admin/views/core/debug/actions/clear-cache/clear-cache.js";
|
|
9
|
-
const SystemLogsView = dynamic(async ()=>import("../../../views/admin/views/core/debug/system-logs/system-logs-view.js").then((module)=>({
|
|
10
|
-
default: module.SystemLogsView
|
|
11
|
-
})));
|
|
12
|
-
export const generateMetadata = async ()=>{
|
|
13
|
-
const t = await getTranslations("admin.debug");
|
|
14
|
-
return {
|
|
15
|
-
title: t("title"),
|
|
16
|
-
description: t("desc")
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export default async function Page(props) {
|
|
20
|
-
const t = await getTranslations("admin.debug");
|
|
21
|
-
return /*#__PURE__*/ _jsx(I18nProvider, {
|
|
22
|
-
namespaces: "admin.debug",
|
|
23
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
24
|
-
className: "p-4",
|
|
25
|
-
children: [
|
|
26
|
-
/*#__PURE__*/ _jsx(HeaderContent, {
|
|
27
|
-
desc: t("desc"),
|
|
28
|
-
h1: t("title"),
|
|
29
|
-
children: /*#__PURE__*/ _jsx(ClearCacheAction, {})
|
|
30
|
-
}),
|
|
31
|
-
/*#__PURE__*/ _jsx(HeaderContent, {
|
|
32
|
-
h2: t("logs.title")
|
|
33
|
-
}),
|
|
34
|
-
/*#__PURE__*/ _jsx(React.Suspense, {
|
|
35
|
-
fallback: /*#__PURE__*/ _jsx(DataTableSkeleton, {
|
|
36
|
-
columns: 4
|
|
37
|
-
}),
|
|
38
|
-
children: /*#__PURE__*/ _jsx(SystemLogsView, {
|
|
39
|
-
...props
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
]
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
}
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{getTranslations}from"next-intl/server";import dynamic from"next/dynamic";import React from"react";import{I18nProvider}from"../../../components/i18n-provider.js";import{DataTableSkeleton}from"../../../components/table/data-table.js";import{HeaderContent}from"../../../components/ui/header-content.js";import{ClearCacheAction}from"../../../views/admin/views/core/debug/actions/clear-cache/clear-cache.js";const SystemLogsView=dynamic(async()=>import("../../../views/admin/views/core/debug/system-logs/system-logs-view.js").then(module=>({default:module.SystemLogsView})));export const generateMetadata=async()=>{const t=await getTranslations("admin.debug");return{title:t("title"),description:t("desc")}};export default async function Page(props){const t=await getTranslations("admin.debug");return _jsx(I18nProvider,{namespaces:"admin.debug",children:_jsxs("div",{className:"p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:t("title"),children:_jsx(ClearCacheAction,{})}),_jsx(HeaderContent,{h2:t("logs.title")}),_jsx(React.Suspense,{fallback:_jsx(DataTableSkeleton,{columns:4}),children:_jsx(SystemLogsView,{...props})})]})})}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DashboardAdminView } from "../../views/admin/views/core/dashboard/dashboard-admin-view.js";
|
|
3
|
-
export default function Page() {
|
|
4
|
-
return /*#__PURE__*/ _jsx(DashboardAdminView, {});
|
|
5
|
-
}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{DashboardAdminView}from"../../views/admin/views/core/dashboard/dashboard-admin-view.js";export default function Page(){return _jsx(DashboardAdminView,{})}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TestView } from "../../../views/admin/views/core/test.js";
|
|
3
|
-
export default function Page() {
|
|
4
|
-
return /*#__PURE__*/ _jsx(TestView, {});
|
|
5
|
-
}
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{TestView}from"../../../views/admin/views/core/test.js";export default function Page(){return _jsx(TestView,{})}
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getTranslations } from "next-intl/server";
|
|
3
|
-
import dynamic from "next/dynamic";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { DataTableSkeleton } from "../../../components/table/data-table.js";
|
|
6
|
-
import { HeaderContent } from "../../../components/ui/header-content.js";
|
|
7
|
-
const UsersAdminView = dynamic(async ()=>import("../../../views/admin/views/core/users/users-admin-view.js").then((module)=>({
|
|
8
|
-
default: module.UsersAdminView
|
|
9
|
-
})));
|
|
10
|
-
export const generateMetadata = async ()=>{
|
|
11
|
-
const t = await getTranslations("admin.global.nav.users");
|
|
12
|
-
return {
|
|
13
|
-
title: t("list")
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export default async function Page(props) {
|
|
17
|
-
const [t, tNav] = await Promise.all([
|
|
18
|
-
getTranslations("admin.user.list"),
|
|
19
|
-
getTranslations("admin.global.nav.users")
|
|
20
|
-
]);
|
|
21
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
22
|
-
className: "p-4",
|
|
23
|
-
children: [
|
|
24
|
-
/*#__PURE__*/ _jsx(HeaderContent, {
|
|
25
|
-
desc: t("desc"),
|
|
26
|
-
h1: tNav("list")
|
|
27
|
-
}),
|
|
28
|
-
/*#__PURE__*/ _jsx(React.Suspense, {
|
|
29
|
-
fallback: /*#__PURE__*/ _jsx(DataTableSkeleton, {
|
|
30
|
-
columns: 2
|
|
31
|
-
}),
|
|
32
|
-
children: /*#__PURE__*/ _jsx(UsersAdminView, {
|
|
33
|
-
...props
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
}
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{getTranslations}from"next-intl/server";import dynamic from"next/dynamic";import React from"react";import{DataTableSkeleton}from"../../../components/table/data-table.js";import{HeaderContent}from"../../../components/ui/header-content.js";const UsersAdminView=dynamic(async()=>import("../../../views/admin/views/core/users/users-admin-view.js").then(module=>({default:module.UsersAdminView})));export const generateMetadata=async()=>{const t=await getTranslations("admin.global.nav.users");return{title:t("list")}};export default async function Page(props){const[t,tNav]=await Promise.all([getTranslations("admin.user.list"),getTranslations("admin.global.nav.users")]);return _jsxs("div",{className:"p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("list")}),_jsx(React.Suspense,{fallback:_jsx(DataTableSkeleton,{columns:2}),children:_jsx(UsersAdminView,{...props})})]})}
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Image from "next/image";
|
|
3
|
-
import { cn } from "../lib/utils.js";
|
|
4
|
-
const generateLetterPhoto = (letter, color)=>`data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" style="background:#${color}"><g><text text-anchor="middle" dy=".35em" x="512" y="512" fill="#ffffff" font-size="700" font-family="-apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif">${letter.toLocaleUpperCase()}</text></g></svg>`)}`;
|
|
5
|
-
export const Avatar = ({ user: { avatarColor, name }, className, size, ...props })=>{
|
|
6
|
-
return /*#__PURE__*/ _jsx(Image, {
|
|
7
|
-
alt: name,
|
|
8
|
-
className: cn("rounded-full object-cover", className),
|
|
9
|
-
height: size,
|
|
10
|
-
src: generateLetterPhoto(name.slice(0, 1), avatarColor),
|
|
11
|
-
width: size,
|
|
12
|
-
...props
|
|
13
|
-
});
|
|
14
|
-
};
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import Image from"next/image";import{cn}from"../lib/utils.js";const generateLetterPhoto=(letter,color)=>`data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" style="background:#${color}"><g><text text-anchor="middle" dy=".35em" x="512" y="512" fill="#ffffff" font-size="700" font-family="-apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif">${letter.toLocaleUpperCase()}</text></g></svg>`)}`;export const Avatar=({user:{avatarColor,name},className,size,...props})=>{return _jsx(Image,{alt:name,className:cn("rounded-full object-cover",className),height:size,src:generateLetterPhoto(name.slice(0,1),avatarColor),width:size,...props})};
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useTranslations } from "next-intl";
|
|
4
|
-
import dynamic from "next/dynamic";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogFooterSkeleton, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "../ui/alert-dialog.js";
|
|
7
|
-
const ContentConfirmAction = dynamic(async ()=>import("./content.js").then((module)=>({
|
|
8
|
-
default: module.ContentConfirmAction
|
|
9
|
-
})));
|
|
10
|
-
export const ConfirmActionAlertDialog = ({ children, title, description, textSubmit, onSubmit, ...props })=>{
|
|
11
|
-
const t = useTranslations("core.global.confirm_action");
|
|
12
|
-
return /*#__PURE__*/ _jsxs(AlertDialog, {
|
|
13
|
-
...props,
|
|
14
|
-
children: [
|
|
15
|
-
/*#__PURE__*/ _jsx(AlertDialogTrigger, {
|
|
16
|
-
asChild: true,
|
|
17
|
-
children: children
|
|
18
|
-
}),
|
|
19
|
-
/*#__PURE__*/ _jsxs(AlertDialogContent, {
|
|
20
|
-
children: [
|
|
21
|
-
/*#__PURE__*/ _jsxs(AlertDialogHeader, {
|
|
22
|
-
children: [
|
|
23
|
-
/*#__PURE__*/ _jsx(AlertDialogTitle, {
|
|
24
|
-
children: title ?? t("title")
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ _jsx(AlertDialogDescription, {
|
|
27
|
-
children: description ?? t("desc")
|
|
28
|
-
})
|
|
29
|
-
]
|
|
30
|
-
}),
|
|
31
|
-
/*#__PURE__*/ _jsx(React.Suspense, {
|
|
32
|
-
fallback: /*#__PURE__*/ _jsx(AlertDialogFooterSkeleton, {}),
|
|
33
|
-
children: /*#__PURE__*/ _jsx(ContentConfirmAction, {
|
|
34
|
-
onSubmit: onSubmit,
|
|
35
|
-
textSubmit: textSubmit
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
]
|
|
39
|
-
})
|
|
40
|
-
]
|
|
41
|
-
});
|
|
42
|
-
};
|
|
1
|
+
"use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useTranslations}from"next-intl";import dynamic from"next/dynamic";import React from"react";import{AlertDialog,AlertDialogContent,AlertDialogDescription,AlertDialogFooterSkeleton,AlertDialogHeader,AlertDialogTitle,AlertDialogTrigger}from"../ui/alert-dialog.js";const ContentConfirmAction=dynamic(async()=>import("./content.js").then(module=>({default:module.ContentConfirmAction})));export const ConfirmActionAlertDialog=({children,title,description,textSubmit,onSubmit,...props})=>{const t=useTranslations("core.global.confirm_action");return _jsxs(AlertDialog,{...props,children:[_jsx(AlertDialogTrigger,{asChild:true,children:children}),_jsxs(AlertDialogContent,{children:[_jsxs(AlertDialogHeader,{children:[_jsx(AlertDialogTitle,{children:title??t("title")}),_jsx(AlertDialogDescription,{children:description??t("desc")})]}),_jsx(React.Suspense,{fallback:_jsx(AlertDialogFooterSkeleton,{}),children:_jsx(ContentConfirmAction,{onSubmit:onSubmit,textSubmit:textSubmit})})]})]})};
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useTranslations } from "next-intl";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { AlertDialogCancel, AlertDialogFooter, useAlertDialog } from "../ui/alert-dialog.js";
|
|
5
|
-
import { Button } from "../ui/button.js";
|
|
6
|
-
export const ContentConfirmAction = ({ onSubmit, textSubmit })=>{
|
|
7
|
-
const t = useTranslations("core.global.confirm_action");
|
|
8
|
-
const { setOpen } = useAlertDialog();
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
-
const [_, formAction, isLoading] = React.useActionState(async ()=>{
|
|
11
|
-
await onSubmit({
|
|
12
|
-
onClose: ()=>setOpen?.(false)
|
|
13
|
-
});
|
|
14
|
-
}, null);
|
|
15
|
-
return /*#__PURE__*/ _jsx("form", {
|
|
16
|
-
action: formAction,
|
|
17
|
-
children: /*#__PURE__*/ _jsxs(AlertDialogFooter, {
|
|
18
|
-
children: [
|
|
19
|
-
/*#__PURE__*/ _jsx(AlertDialogCancel, {
|
|
20
|
-
children: t("cancel")
|
|
21
|
-
}),
|
|
22
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
23
|
-
isLoading: isLoading,
|
|
24
|
-
type: "submit",
|
|
25
|
-
variant: "destructive",
|
|
26
|
-
children: textSubmit ?? t("confirm")
|
|
27
|
-
})
|
|
28
|
-
]
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
};
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useTranslations}from"next-intl";import React from"react";import{AlertDialogCancel,AlertDialogFooter,useAlertDialog}from"../ui/alert-dialog.js";import{Button}from"../ui/button.js";export const ContentConfirmAction=({onSubmit,textSubmit})=>{const t=useTranslations("core.global.confirm_action");const{setOpen}=useAlertDialog();const[_,formAction,isLoading]=React.useActionState(async()=>{await onSubmit({onClose:()=>setOpen?.(false)})},null);return _jsx("form",{action:formAction,children:_jsxs(AlertDialogFooter,{children:[_jsx(AlertDialogCancel,{children:t("cancel")}),_jsx(Button,{isLoading:isLoading,type:"submit",variant:"destructive",children:textSubmit??t("confirm")})]})})};
|
|
@@ -1,41 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useFormatter, useNow } from "next-intl";
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip.js";
|
|
5
|
-
export const DateFormat = ({ date, updateInterval, showFullDate })=>{
|
|
6
|
-
const dateToFormat = typeof date === "string" ? new Date(date) : date;
|
|
7
|
-
const format = useFormatter();
|
|
8
|
-
const now = useNow({
|
|
9
|
-
updateInterval: updateInterval ?? // Update it every 1 minute if the date is from today, otherwise don't update
|
|
10
|
-
(Date.now() - dateToFormat.getTime() < 86400000 ? 60000 : 0)
|
|
11
|
-
});
|
|
12
|
-
const fullDate = format.dateTime(dateToFormat, {
|
|
13
|
-
year: dateToFormat.getFullYear() === now.getFullYear() ? undefined : "numeric",
|
|
14
|
-
month: "short",
|
|
15
|
-
day: "numeric",
|
|
16
|
-
hour: "numeric",
|
|
17
|
-
minute: "numeric"
|
|
18
|
-
});
|
|
19
|
-
if (showFullDate) {
|
|
20
|
-
return fullDate;
|
|
21
|
-
}
|
|
22
|
-
// When date is < 7 days
|
|
23
|
-
if (now.getTime() - dateToFormat.getTime() < 604800000) {
|
|
24
|
-
return /*#__PURE__*/ _jsx(TooltipProvider, {
|
|
25
|
-
children: /*#__PURE__*/ _jsxs(Tooltip, {
|
|
26
|
-
children: [
|
|
27
|
-
/*#__PURE__*/ _jsx(TooltipTrigger, {
|
|
28
|
-
asChild: true,
|
|
29
|
-
children: /*#__PURE__*/ _jsx("span", {
|
|
30
|
-
children: format.relativeTime(dateToFormat, now)
|
|
31
|
-
})
|
|
32
|
-
}),
|
|
33
|
-
/*#__PURE__*/ _jsx(TooltipContent, {
|
|
34
|
-
children: fullDate
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
})
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return fullDate;
|
|
41
|
-
};
|
|
1
|
+
"use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useFormatter,useNow}from"next-intl";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"./ui/tooltip.js";export const DateFormat=({date,updateInterval,showFullDate})=>{const dateToFormat=typeof date==="string"?new Date(date):date;const format=useFormatter();const now=useNow({updateInterval:updateInterval??(Date.now()-dateToFormat.getTime()<864e5?6e4:0)});const fullDate=format.dateTime(dateToFormat,{year:dateToFormat.getFullYear()===now.getFullYear()?undefined:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"});if(showFullDate){return fullDate}if(now.getTime()-dateToFormat.getTime()<6048e5){return _jsx(TooltipProvider,{children:_jsxs(Tooltip,{children:[_jsx(TooltipTrigger,{asChild:true,children:_jsx("span",{children:format.relativeTime(dateToFormat,now)})}),_jsx(TooltipContent,{children:fullDate})]})})}return fullDate};
|