@vitnode/core 1.2.0-canary.24 → 1.2.0-canary.26

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.
Files changed (43) hide show
  1. package/dist/src/api/lib/logger-middleware.d.ts.map +1 -1
  2. package/dist/src/api/lib/logger-middleware.js +6 -1
  3. package/dist/src/api/modules/admin/admin.module.d.ts +62 -0
  4. package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -1
  5. package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts +62 -0
  6. package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts.map +1 -1
  7. package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts +62 -0
  8. package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts.map +1 -1
  9. package/dist/src/api/modules/admin/debug/routes/logs.route.js +23 -3
  10. package/dist/src/api/modules/users/routes/test.route.d.ts +1 -1
  11. package/dist/src/api/modules/users/routes/test.route.js +2 -2
  12. package/dist/src/api/modules/users/users.module.d.ts +1 -1
  13. package/dist/src/app_admin/core/debug/page.d.ts +2 -2
  14. package/dist/src/app_admin/core/debug/page.d.ts.map +1 -1
  15. package/dist/src/app_admin/core/debug/page.js +3 -3
  16. package/dist/src/components/ui/dialog.js +1 -1
  17. package/dist/src/database/logs.d.ts +87 -0
  18. package/dist/src/database/logs.d.ts.map +1 -1
  19. package/dist/src/database/logs.js +14 -1
  20. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.d.ts +3 -0
  21. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.d.ts.map +1 -0
  22. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.js +281 -0
  23. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.d.ts +5 -0
  24. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.d.ts.map +1 -0
  25. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.js +74 -0
  26. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.d.ts +4 -0
  27. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.d.ts.map +1 -0
  28. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.js +8 -0
  29. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.d.ts +3 -0
  30. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.d.ts.map +1 -0
  31. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.js +30 -0
  32. package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.d.ts +31 -0
  33. package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.d.ts.map +1 -0
  34. package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.js +96 -0
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +19 -19
  37. package/src/app_admin/core/debug/page.tsx +8 -6
  38. package/src/locales/en.json +25 -1
  39. package/dist/src/views/admin/views/core/debug/debug-admin-view.d.ts +0 -4
  40. package/dist/src/views/admin/views/core/debug/debug-admin-view.d.ts.map +0 -1
  41. package/dist/src/views/admin/views/core/debug/debug-admin-view.js +0 -110
  42. package/src/drizzle.config.ts +0 -58
  43. package/src/vitnode.config.ts +0 -114
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitnode/core",
3
- "version": "1.2.0-canary.24",
3
+ "version": "1.2.0-canary.26",
4
4
  "description": "Core package for VitNode, providing essential functionalities and configurations.",
5
5
  "author": "VitNode Team",
6
6
  "license": "MIT",
@@ -28,44 +28,44 @@
28
28
  "drizzle-orm": "^0.44.x",
29
29
  "hono": "4.8.x",
30
30
  "next": "15.3.x",
31
- "next-intl": "4.1.x",
31
+ "next-intl": "4.x.x",
32
32
  "react": "19.1.x",
33
33
  "react-dom": "19.1.x",
34
34
  "react-hook-form": "^7.0.0",
35
35
  "typescript": "^5.8.x",
36
- "zod": "3.25.x"
36
+ "zod": "3.x.x"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@hono/zod-openapi": "^0.19.8",
40
40
  "@hono/zod-validator": "^0.7.0",
41
41
  "@hookform/resolvers": "^5.1.1",
42
- "@react-email/components": "0.1.0",
42
+ "@react-email/components": "^0.1.0",
43
43
  "@swc/cli": "0.6.0",
44
- "@swc/core": "^1.12.5",
44
+ "@swc/core": "^1.12.7",
45
45
  "@testing-library/dom": "^10.4.0",
46
46
  "@testing-library/react": "^16.3.0",
47
- "@types/node": "^24.0.3",
47
+ "@types/node": "^24",
48
48
  "@types/nodemailer": "^6.4.17",
49
- "@types/react": "^19.1.8",
50
- "@types/react-dom": "^19.1.6",
51
- "@vitejs/plugin-react": "^4.5.2",
49
+ "@types/react": "^19.1",
50
+ "@types/react-dom": "^19.1",
51
+ "@vitejs/plugin-react": "^4.6.0",
52
52
  "@vitest/coverage-v8": "^3.2.4",
53
53
  "chokidar": "^4.0.3",
54
- "concurrently": "^9.1.2",
55
- "drizzle-kit": "^0.31.1",
54
+ "concurrently": "^9.2.0",
55
+ "drizzle-kit": "^0.31.3",
56
56
  "drizzle-orm": "^0.44.2",
57
57
  "eslint": "^9.29.0",
58
- "hono": "^4.8.2",
58
+ "hono": "^4.8.3",
59
59
  "jsdom": "^26.1.0",
60
- "lucide-react": "^0.517.0",
60
+ "lucide-react": "^0.523.0",
61
61
  "next": "^15.3.4",
62
- "next-intl": "^4.1.0",
62
+ "next-intl": "^4.3.1",
63
63
  "react": "^19.1.0",
64
64
  "react-dom": "^19.1.0",
65
- "react-email": "^4.0.16",
65
+ "react-email": "^4.0.17",
66
66
  "react-hook-form": "^7.58.1",
67
67
  "sonner": "^2.0.5",
68
- "tailwindcss": "^4.1.10",
68
+ "tailwindcss": "^4.1.11",
69
69
  "tsc-alias": "^1.8.16",
70
70
  "tsup": "^8.5.0",
71
71
  "tsx": "^4.20.3",
@@ -74,7 +74,7 @@
74
74
  "vite-tsconfig-paths": "^5.1.4",
75
75
  "vitest": "^3.2.4",
76
76
  "zod": "^3.25.67",
77
- "@vitnode/eslint-config": "1.2.0-canary.24"
77
+ "@vitnode/eslint-config": "1.2.0-canary.26"
78
78
  },
79
79
  "bin": {
80
80
  "vitnode": "./dist/scripts/scripts.js"
@@ -97,11 +97,11 @@
97
97
  "dependencies": {
98
98
  "@dnd-kit/core": "^6.3.1",
99
99
  "@hono/swagger-ui": "^0.5.2",
100
- "@tanstack/react-query": "^5.80.12",
100
+ "@tanstack/react-query": "^5.81.2",
101
101
  "class-variance-authority": "^0.7.1",
102
102
  "clsx": "^2.1.1",
103
103
  "cmdk": "^1.1.1",
104
- "dotenv": "^16.5.0",
104
+ "dotenv": "^16.6.0",
105
105
  "input-otp": "^1.4.2",
106
106
  "next-themes": "^0.4.6",
107
107
  "nodemailer": "^7.0.3",
@@ -6,10 +6,12 @@ import { DataTableSkeleton } from '@/components/table/data-table';
6
6
  import { HeaderContent } from '@/components/ui/header-content';
7
7
  import { ClearCacheAction } from '@/views/admin/views/core/debug/actions/clear-cache/clear-cache';
8
8
 
9
- const DebugAdminView = React.lazy(async () =>
10
- import('@/views/admin/views/core/debug/debug-admin-view').then(module => ({
11
- default: module.DebugAdminView,
12
- })),
9
+ const SystemLogsView = React.lazy(async () =>
10
+ import('@/views/admin/views/core/debug/system-logs/system-logs-view').then(
11
+ module => ({
12
+ default: module.SystemLogsView,
13
+ }),
14
+ ),
13
15
  );
14
16
 
15
17
  export const generateMetadata = async () => {
@@ -22,7 +24,7 @@ export const generateMetadata = async () => {
22
24
  };
23
25
 
24
26
  export default async function Page(
25
- props: React.ComponentProps<typeof DebugAdminView>,
27
+ props: React.ComponentProps<typeof SystemLogsView>,
26
28
  ) {
27
29
  const t = await getTranslations('admin.debug');
28
30
 
@@ -35,7 +37,7 @@ export default async function Page(
35
37
 
36
38
  <HeaderContent h2={t('logs.title')} />
37
39
  <React.Suspense fallback={<DataTableSkeleton columns={4} />}>
38
- <DebugAdminView {...props} />
40
+ <SystemLogsView {...props} />
39
41
  </React.Suspense>
40
42
  </div>
41
43
  </I18nProvider>
@@ -173,7 +173,6 @@
173
173
  },
174
174
  "logs": {
175
175
  "title": "System Logs",
176
- "id": "ID",
177
176
  "created_at": "Created At",
178
177
  "plugin": "Plugin",
179
178
  "content": "Content",
@@ -182,6 +181,31 @@
182
181
  "warn": "Warning",
183
182
  "error": "Error",
184
183
  "debug": "Debug"
184
+ },
185
+ "status_code": "Status Code",
186
+ "more": {
187
+ "title": "More Details",
188
+ "desc": "Log ID: <logId></logId>",
189
+ "log_overview": {
190
+ "title": "Log Overview",
191
+ "log_type": "Log Type",
192
+ "status_code": "Status Code",
193
+ "log_id": "Log ID",
194
+ "created_at": "Created At",
195
+ "plugin": "Plugin",
196
+ "user": "User"
197
+ },
198
+ "request_information": {
199
+ "title": "Request Information",
200
+ "ip_address": "IP Address",
201
+ "request_method": "Request Method",
202
+ "request_url": "Request URL",
203
+ "user_agent": "User Agent"
204
+ },
205
+ "log_content": {
206
+ "title": "Log Content",
207
+ "full_log": "Full Log Message"
208
+ }
185
209
  }
186
210
  }
187
211
  }
@@ -1,4 +0,0 @@
1
- export declare const DebugAdminView: ({ searchParams, }: {
2
- searchParams: Promise<Record<string, string | string[] | undefined>>;
3
- }) => Promise<import("react/jsx-runtime").JSX.Element>;
4
- //# sourceMappingURL=debug-admin-view.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug-admin-view.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/views/core/debug/debug-admin-view.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,GAAU,mBAElC;IACD,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;CACtE,qDAwFA,CAAC"}
@@ -1,110 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { TriangleAlertIcon, XIcon } from "lucide-react";
3
- import { getTranslations } from "next-intl/server";
4
- import { debugAdminModule } from "../../../../../api/modules/admin/debug/debug.admin.module.js";
5
- import { DateFormat } from "../../../../../components/date-format.js";
6
- import { DataTable } from "../../../../../components/table/data-table.js";
7
- import { Badge } from "../../../../../components/ui/badge.js";
8
- import { fetcher } from "../../../../../lib/fetcher.js";
9
- export const DebugAdminView = async ({ searchParams })=>{
10
- const t = await getTranslations('admin.debug.logs');
11
- const query = await searchParams;
12
- const res = await fetcher(debugAdminModule, {
13
- prefixPath: '/admin',
14
- path: '/logs',
15
- method: 'get',
16
- module: 'debug',
17
- args: {
18
- query
19
- },
20
- withPagination: true
21
- });
22
- const data = await res.json();
23
- return /*#__PURE__*/ _jsx(DataTable, {
24
- columns: [
25
- {
26
- id: 'id',
27
- label: t('id'),
28
- className: 'w-24'
29
- },
30
- {
31
- id: 'type',
32
- label: t('type'),
33
- className: 'w-48',
34
- cell: ({ row })=>{
35
- if (row.type === 'warn') {
36
- return /*#__PURE__*/ _jsxs(Badge, {
37
- className: "bg-warn/10 border-warn/50 text-warn",
38
- children: [
39
- /*#__PURE__*/ _jsx(TriangleAlertIcon, {}),
40
- " ",
41
- t(`types.${row.type}`)
42
- ]
43
- });
44
- }
45
- if (row.type === 'error') {
46
- return /*#__PURE__*/ _jsxs(Badge, {
47
- className: "bg-destructive/10 border-destructive/50 text-destructive",
48
- children: [
49
- /*#__PURE__*/ _jsx(XIcon, {}),
50
- " ",
51
- t(`types.${row.type}`)
52
- ]
53
- });
54
- }
55
- return /*#__PURE__*/ _jsx(Badge, {
56
- children: t(`types.${row.type}`)
57
- });
58
- }
59
- },
60
- {
61
- id: 'pluginId',
62
- label: t('plugin'),
63
- className: 'w-48'
64
- },
65
- {
66
- id: 'createdAt',
67
- label: t('created_at'),
68
- cell: ({ row })=>/*#__PURE__*/ _jsx(DateFormat, {
69
- date: row.createdAt,
70
- showFullDate: true
71
- })
72
- },
73
- {
74
- id: 'content',
75
- label: t('content'),
76
- cell: ({ row })=>{
77
- const CHARACTERS = 50;
78
- const content = row.content;
79
- const isLong = content.length > CHARACTERS;
80
- const displayContent = isLong ? content.slice(0, CHARACTERS) + '...' : content;
81
- return /*#__PURE__*/ _jsx("span", {
82
- children: displayContent
83
- });
84
- }
85
- },
86
- {
87
- id: 'actions',
88
- label: '',
89
- cell: ({ row })=>/*#__PURE__*/ _jsx("span", {
90
- children: "actions"
91
- })
92
- }
93
- ],
94
- edges: data.edges.map((edge)=>({
95
- ...edge
96
- })),
97
- order: {
98
- columns: [
99
- 'createdAt',
100
- 'pluginId',
101
- 'type'
102
- ],
103
- defaultOrder: {
104
- column: 'createdAt',
105
- order: 'desc'
106
- }
107
- },
108
- pageInfo: data.pageInfo
109
- });
110
- };
@@ -1,58 +0,0 @@
1
- import type { Config } from 'drizzle-kit';
2
-
3
- import { defineConfig } from 'drizzle-kit';
4
- import { existsSync, readdirSync } from 'fs';
5
- import { join, resolve } from 'path';
6
-
7
- import type { VitNodeApiConfig } from './vitnode.config';
8
-
9
- export const defineVitNodeDrizzleConfig = ({
10
- vitNodeApiConfig,
11
- ...args
12
- }: Config & {
13
- vitNodeApiConfig: VitNodeApiConfig;
14
- }) => {
15
- const pluginId = vitNodeApiConfig.plugins.map(plugin => plugin.pluginId);
16
-
17
- const pluginPaths = ['@vitnode/core', ...pluginId]
18
- .map(itemId => {
19
- const pluginPath = resolve(
20
- process.cwd(),
21
- 'node_modules',
22
- itemId,
23
- 'dist',
24
- 'src',
25
- 'database',
26
- );
27
-
28
- // Check if the plugin path exists
29
- if (!existsSync(pluginPath)) {
30
- return null;
31
- }
32
-
33
- // Check if there are any .ts files in the directory
34
- try {
35
- const files = readdirSync(pluginPath);
36
- const hasSchemaFiles = files.some(file => file.endsWith('.js'));
37
- if (!hasSchemaFiles) return null;
38
-
39
- // Return glob pattern for schema files
40
- return join(pluginPath, '*.js').replace(/\\/g, '/');
41
- } catch {
42
- return null;
43
- }
44
- })
45
- .filter(pluginPath => pluginPath !== null);
46
-
47
- return defineConfig({
48
- ...args,
49
- schema: [
50
- ...(Array.isArray(args.schema)
51
- ? args.schema
52
- : args.schema
53
- ? [args.schema]
54
- : []),
55
- ...pluginPaths,
56
- ],
57
- });
58
- };
@@ -1,114 +0,0 @@
1
- import type { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
2
- import type { ThemeProvider } from 'next-themes';
3
- import type { IRateLimiterOptions } from 'rate-limiter-flexible';
4
-
5
- import type { BuildPluginApiReturn } from './api/lib/plugin';
6
- import type { EmailApiPlugin } from './api/models/email';
7
- import type { SSOApiPlugin } from './api/models/sso';
8
- import type { BuildPluginReturn } from './lib/plugin';
9
-
10
- export interface LocaleConfig {
11
- code: string;
12
- name: string;
13
- }
14
-
15
- export interface VitNodeConfig<
16
- AppLocales extends LocaleConfig[] = LocaleConfig[],
17
- > {
18
- admin?: {
19
- sidebarCookieName?: string;
20
- };
21
- debug?: boolean;
22
- i18n: {
23
- defaultLocale: AppLocales[number]['code'];
24
- localePrefix?: 'always' | 'as-needed' | 'never';
25
- locales: AppLocales;
26
- timeZone?: string;
27
- };
28
- metadata: {
29
- shortTitle?: string;
30
- title: string;
31
- };
32
- plugins: BuildPluginReturn[];
33
- theme?: Omit<
34
- React.ComponentProps<typeof ThemeProvider>,
35
- 'attribute' | 'disableTransitionOnChange' | 'enableSystem'
36
- >;
37
- }
38
-
39
- export interface VitNodeApiConfig {
40
- authorization?: {
41
- adminCookieExpires?: number;
42
- adminCookieName?: string;
43
- cookieExpires?: number;
44
- cookieName?: string;
45
- cookieSecure?: boolean;
46
- deviceCookieExpires?: number;
47
- deviceCookieName?: string;
48
- ssoProviders?: SSOApiPlugin[];
49
- };
50
- dbProvider: PostgresJsDatabase;
51
- emailAdapter?: EmailApiPlugin;
52
- plugins: BuildPluginApiReturn[];
53
- rateLimiter?: Omit<IRateLimiterOptions, 'keyPrefix'>;
54
- }
55
-
56
- export function buildConfig<AppLocales extends LocaleConfig[]>(
57
- args: VitNodeConfig<AppLocales>,
58
- ): VitNodeConfig<AppLocales> {
59
- return {
60
- ...args,
61
- i18n: {
62
- ...args.i18n,
63
- localePrefix: args.i18n.localePrefix ?? 'as-needed',
64
- },
65
- };
66
- }
67
-
68
- export function buildApiConfig(args: VitNodeApiConfig): VitNodeApiConfig {
69
- return args;
70
- }
71
-
72
- export const handleRequestConfig = async ({
73
- requestLocale,
74
- vitNodeConfig,
75
- pathToMessages,
76
- }: {
77
- pathToMessages: (path: string) => Promise<{ default: object }>;
78
- requestLocale: Promise<string | undefined>;
79
- vitNodeConfig: VitNodeConfig;
80
- }) => {
81
- const reqLocale = await requestLocale;
82
- const localeCodes = vitNodeConfig.i18n.locales.map(locale => locale.code);
83
- const locale =
84
- reqLocale && localeCodes.includes(reqLocale)
85
- ? reqLocale
86
- : vitNodeConfig.i18n.defaultLocale;
87
-
88
- const pluginIds: string[] = [
89
- '@vitnode/core',
90
- ...vitNodeConfig.plugins.map(plugin => plugin.pluginId),
91
- ];
92
-
93
- // Import and merge messages from all plugins
94
- const messagesPromises = pluginIds.map(async pluginId => {
95
- try {
96
- const path = `${pluginId}/${locale}.json`;
97
- const messages = await pathToMessages(path);
98
-
99
- return messages.default;
100
- } catch {
101
- return {};
102
- }
103
- });
104
-
105
- const allMessages = await Promise.all(messagesPromises);
106
- const messages = allMessages.reduce((acc, curr) => ({ ...acc, ...curr }), {});
107
-
108
- return {
109
- locale,
110
- messages,
111
- pluginIds,
112
- timeZone: vitNodeConfig.i18n.timeZone,
113
- };
114
- };