@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/views/admin/views/core/debug/system-logs/actions/more/content.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAKhE,eAAO,MAAM,2BAA2B,GAAI,mGAYzC,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,4CAiLhE,CAAC"}
@@ -0,0 +1,281 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CalendarIcon, GlobeIcon, HashIcon, PlugIcon, ServerIcon, UserIcon } from "lucide-react";
3
+ import { useTranslations } from "next-intl";
4
+ import { DateFormat } from "../../../../../../../../components/date-format.js";
5
+ import { Badge } from "../../../../../../../../components/ui/badge.js";
6
+ import { Card, CardContent, CardHeader, CardTitle } from "../../../../../../../../components/ui/card.js";
7
+ import { Input } from "../../../../../../../../components/ui/input.js";
8
+ import { Label } from "../../../../../../../../components/ui/label.js";
9
+ import { Textarea } from "../../../../../../../../components/ui/textarea.js";
10
+ import { Link } from "../../../../../../../../lib/navigation.js";
11
+ import { BadgeStatus } from "../../badges/badge-status.js";
12
+ import { BadgeTypeLog } from "../../badges/badge-type-log.js";
13
+ export const ContentMoreActionSystemLogs = ({ content, ipAddress, pluginId, createdAt, type, id, method, path, userAgent, statusCode, user })=>{
14
+ const t = useTranslations('admin.debug.logs.more');
15
+ return /*#__PURE__*/ _jsxs("div", {
16
+ className: "space-y-6",
17
+ children: [
18
+ /*#__PURE__*/ _jsxs(Card, {
19
+ children: [
20
+ /*#__PURE__*/ _jsx(CardHeader, {
21
+ children: /*#__PURE__*/ _jsxs(CardTitle, {
22
+ className: "flex items-center gap-2",
23
+ children: [
24
+ /*#__PURE__*/ _jsx(HashIcon, {
25
+ className: "size-4"
26
+ }),
27
+ t('log_overview.title')
28
+ ]
29
+ })
30
+ }),
31
+ /*#__PURE__*/ _jsxs(CardContent, {
32
+ className: "space-y-6",
33
+ children: [
34
+ /*#__PURE__*/ _jsxs("div", {
35
+ className: "grid grid-cols-1 gap-4 md:grid-cols-3",
36
+ children: [
37
+ /*#__PURE__*/ _jsxs("div", {
38
+ className: "space-y-2",
39
+ children: [
40
+ /*#__PURE__*/ _jsx(Label, {
41
+ className: "text-muted-foreground text-xs font-medium",
42
+ htmlFor: "log-type",
43
+ children: t('log_overview.log_type')
44
+ }),
45
+ /*#__PURE__*/ _jsx(BadgeTypeLog, {
46
+ type: type
47
+ })
48
+ ]
49
+ }),
50
+ /*#__PURE__*/ _jsxs("div", {
51
+ className: "space-y-2",
52
+ children: [
53
+ /*#__PURE__*/ _jsx(Label, {
54
+ className: "text-muted-foreground text-xs font-medium",
55
+ children: t('log_overview.status_code')
56
+ }),
57
+ /*#__PURE__*/ _jsx(BadgeStatus, {
58
+ statusCode: statusCode
59
+ })
60
+ ]
61
+ }),
62
+ /*#__PURE__*/ _jsxs("div", {
63
+ className: "space-y-2",
64
+ children: [
65
+ /*#__PURE__*/ _jsx(Label, {
66
+ className: "text-muted-foreground text-xs font-medium",
67
+ htmlFor: "log-id",
68
+ children: t('log_overview.log_id')
69
+ }),
70
+ /*#__PURE__*/ _jsx(Input, {
71
+ id: "log-id",
72
+ readOnly: true,
73
+ value: `#${id}`
74
+ })
75
+ ]
76
+ })
77
+ ]
78
+ }),
79
+ /*#__PURE__*/ _jsxs("div", {
80
+ className: "grid grid-cols-1 gap-4 md:grid-cols-3",
81
+ children: [
82
+ /*#__PURE__*/ _jsxs("div", {
83
+ className: "space-y-2",
84
+ children: [
85
+ /*#__PURE__*/ _jsxs(Label, {
86
+ className: "text-muted-foreground flex items-center gap-1 text-xs font-medium",
87
+ htmlFor: "created-at",
88
+ children: [
89
+ /*#__PURE__*/ _jsx(CalendarIcon, {
90
+ className: "size-3"
91
+ }),
92
+ t('log_overview.created_at')
93
+ ]
94
+ }),
95
+ /*#__PURE__*/ _jsx("div", {
96
+ className: "text-sm",
97
+ id: "created-at",
98
+ children: /*#__PURE__*/ _jsx(DateFormat, {
99
+ date: createdAt
100
+ })
101
+ })
102
+ ]
103
+ }),
104
+ /*#__PURE__*/ _jsxs("div", {
105
+ className: "space-y-2",
106
+ children: [
107
+ /*#__PURE__*/ _jsxs(Label, {
108
+ className: "text-muted-foreground flex items-center gap-1 text-xs font-medium",
109
+ htmlFor: "plugin-id",
110
+ children: [
111
+ /*#__PURE__*/ _jsx(PlugIcon, {
112
+ className: "size-3"
113
+ }),
114
+ t('log_overview.plugin')
115
+ ]
116
+ }),
117
+ /*#__PURE__*/ _jsx(Input, {
118
+ id: "plugin-id",
119
+ readOnly: true,
120
+ value: pluginId
121
+ })
122
+ ]
123
+ }),
124
+ user && /*#__PURE__*/ _jsxs("div", {
125
+ className: "space-y-2",
126
+ children: [
127
+ /*#__PURE__*/ _jsxs(Label, {
128
+ className: "text-muted-foreground flex items-center gap-1 text-xs font-medium",
129
+ htmlFor: "user-link",
130
+ children: [
131
+ /*#__PURE__*/ _jsx(UserIcon, {
132
+ className: "size-3"
133
+ }),
134
+ t('log_overview.user')
135
+ ]
136
+ }),
137
+ /*#__PURE__*/ _jsxs(Link, {
138
+ className: "border-input bg-background hover:bg-accent hover:text-accent-foreground block rounded-md border px-3 py-2 text-sm font-medium",
139
+ href: `/admin/core/users/${user.id}`,
140
+ id: "user-link",
141
+ children: [
142
+ user.name,
143
+ " (#",
144
+ user.id,
145
+ ")"
146
+ ]
147
+ })
148
+ ]
149
+ })
150
+ ]
151
+ })
152
+ ]
153
+ })
154
+ ]
155
+ }),
156
+ /*#__PURE__*/ _jsxs(Card, {
157
+ children: [
158
+ /*#__PURE__*/ _jsx(CardHeader, {
159
+ children: /*#__PURE__*/ _jsxs(CardTitle, {
160
+ className: "flex items-center gap-2",
161
+ children: [
162
+ /*#__PURE__*/ _jsx(GlobeIcon, {
163
+ className: "size-4"
164
+ }),
165
+ t('request_information.title')
166
+ ]
167
+ })
168
+ }),
169
+ /*#__PURE__*/ _jsxs(CardContent, {
170
+ className: "space-y-6",
171
+ children: [
172
+ /*#__PURE__*/ _jsxs("div", {
173
+ className: "grid grid-cols-1 gap-6 md:grid-cols-2",
174
+ children: [
175
+ /*#__PURE__*/ _jsxs("div", {
176
+ className: "space-y-3",
177
+ children: [
178
+ /*#__PURE__*/ _jsx(Label, {
179
+ className: "text-muted-foreground text-xs font-medium",
180
+ htmlFor: "ip-address",
181
+ children: t('request_information.ip_address')
182
+ }),
183
+ /*#__PURE__*/ _jsx(Input, {
184
+ id: "ip-address",
185
+ readOnly: true,
186
+ value: ipAddress
187
+ })
188
+ ]
189
+ }),
190
+ /*#__PURE__*/ _jsxs("div", {
191
+ className: "space-y-3",
192
+ children: [
193
+ /*#__PURE__*/ _jsx(Label, {
194
+ className: "text-muted-foreground text-xs font-medium",
195
+ htmlFor: "request-method",
196
+ children: t('request_information.request_method')
197
+ }),
198
+ /*#__PURE__*/ _jsx("div", {
199
+ className: "flex",
200
+ children: /*#__PURE__*/ _jsx(Badge, {
201
+ className: "px-3 py-1",
202
+ id: "request-method",
203
+ variant: "outline",
204
+ children: method
205
+ })
206
+ })
207
+ ]
208
+ })
209
+ ]
210
+ }),
211
+ /*#__PURE__*/ _jsxs("div", {
212
+ className: "space-y-3",
213
+ children: [
214
+ /*#__PURE__*/ _jsx(Label, {
215
+ className: "text-muted-foreground text-xs font-medium",
216
+ htmlFor: "request-url",
217
+ children: t('request_information.request_url')
218
+ }),
219
+ /*#__PURE__*/ _jsx(Input, {
220
+ id: "request-url",
221
+ readOnly: true,
222
+ value: path
223
+ })
224
+ ]
225
+ }),
226
+ userAgent && /*#__PURE__*/ _jsxs("div", {
227
+ className: "space-y-3",
228
+ children: [
229
+ /*#__PURE__*/ _jsx(Label, {
230
+ className: "text-muted-foreground text-xs font-medium",
231
+ htmlFor: "user-agent",
232
+ children: t('request_information.user_agent')
233
+ }),
234
+ /*#__PURE__*/ _jsx(Textarea, {
235
+ className: "resize-none font-mono text-sm",
236
+ id: "user-agent",
237
+ readOnly: true,
238
+ value: userAgent
239
+ })
240
+ ]
241
+ })
242
+ ]
243
+ })
244
+ ]
245
+ }),
246
+ /*#__PURE__*/ _jsxs(Card, {
247
+ children: [
248
+ /*#__PURE__*/ _jsx(CardHeader, {
249
+ children: /*#__PURE__*/ _jsxs(CardTitle, {
250
+ className: "flex items-center gap-2",
251
+ children: [
252
+ /*#__PURE__*/ _jsx(ServerIcon, {
253
+ className: "size-4"
254
+ }),
255
+ t('log_content.title')
256
+ ]
257
+ })
258
+ }),
259
+ /*#__PURE__*/ _jsx(CardContent, {
260
+ children: /*#__PURE__*/ _jsxs("div", {
261
+ className: "space-y-2",
262
+ children: [
263
+ /*#__PURE__*/ _jsx(Label, {
264
+ className: "text-muted-foreground text-xs font-medium",
265
+ htmlFor: "log-content",
266
+ children: t('log_content.full_log')
267
+ }),
268
+ /*#__PURE__*/ _jsx(Textarea, {
269
+ className: "min-h-[120px] font-mono text-sm",
270
+ id: "log-content",
271
+ readOnly: true,
272
+ value: content
273
+ })
274
+ ]
275
+ })
276
+ })
277
+ ]
278
+ })
279
+ ]
280
+ });
281
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const ContentMoreActionSystemLogs: React.LazyExoticComponent<({ content, ipAddress, pluginId, createdAt, type, id, method, path, userAgent, statusCode, user, }: Awaited<ReturnType<typeof import("../../system-logs-view").getSystemLogsData>>["edges"][number]) => import("react/jsx-runtime").JSX.Element>;
3
+ export declare const MoreActionSystemLogs: (props: React.ComponentProps<typeof ContentMoreActionSystemLogs>) => import("react/jsx-runtime").JSX.Element;
4
+ export {};
5
+ //# sourceMappingURL=more.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"more.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/views/admin/views/core/debug/system-logs/actions/more/more.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,QAAA,MAAM,2BAA2B,gIAevB,uFACkB,qDAZ3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,KAAK,CAAC,cAAc,CAAC,OAAO,2BAA2B,CAAC,4CAsChE,CAAC"}
@@ -0,0 +1,74 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { SearchIcon } from "lucide-react";
4
+ import { useTranslations } from "next-intl";
5
+ import React from "react";
6
+ import { Button } from "../../../../../../../../components/ui/button.js";
7
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "../../../../../../../../components/ui/dialog.js";
8
+ import { Loader } from "../../../../../../../../components/ui/loader.js";
9
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../../../../../../../components/ui/tooltip.js";
10
+ const ContentMoreActionSystemLogs = /*#__PURE__*/ React.lazy(async ()=>import("./content.js").then((module)=>({
11
+ default: module.ContentMoreActionSystemLogs
12
+ })));
13
+ export const MoreActionSystemLogs = (props)=>{
14
+ const t = useTranslations('admin.debug.logs.more');
15
+ return /*#__PURE__*/ _jsxs(Dialog, {
16
+ children: [
17
+ /*#__PURE__*/ _jsx(TooltipProvider, {
18
+ children: /*#__PURE__*/ _jsxs(Tooltip, {
19
+ children: [
20
+ /*#__PURE__*/ _jsx(TooltipTrigger, {
21
+ asChild: true,
22
+ children: /*#__PURE__*/ _jsx(DialogTrigger, {
23
+ asChild: true,
24
+ children: /*#__PURE__*/ _jsx(Button, {
25
+ size: "icon",
26
+ variant: "ghost",
27
+ children: /*#__PURE__*/ _jsx(SearchIcon, {})
28
+ })
29
+ })
30
+ }),
31
+ /*#__PURE__*/ _jsx(TooltipContent, {
32
+ children: t('title')
33
+ })
34
+ ]
35
+ })
36
+ }),
37
+ /*#__PURE__*/ _jsxs(DialogContent, {
38
+ className: "sm:max-w-4xl",
39
+ children: [
40
+ /*#__PURE__*/ _jsxs(DialogHeader, {
41
+ children: [
42
+ /*#__PURE__*/ _jsxs(DialogTitle, {
43
+ className: "flex items-center gap-2",
44
+ children: [
45
+ /*#__PURE__*/ _jsx(SearchIcon, {
46
+ className: "size-5"
47
+ }),
48
+ t('title')
49
+ ]
50
+ }),
51
+ /*#__PURE__*/ _jsx(DialogDescription, {
52
+ children: t.rich('desc', {
53
+ logId: ()=>/*#__PURE__*/ _jsxs("span", {
54
+ className: "font-semibold",
55
+ children: [
56
+ "#",
57
+ props.id
58
+ ]
59
+ })
60
+ })
61
+ })
62
+ ]
63
+ }),
64
+ /*#__PURE__*/ _jsx(React.Suspense, {
65
+ fallback: /*#__PURE__*/ _jsx(Loader, {}),
66
+ children: /*#__PURE__*/ _jsx(ContentMoreActionSystemLogs, {
67
+ ...props
68
+ })
69
+ })
70
+ ]
71
+ })
72
+ ]
73
+ });
74
+ };
@@ -0,0 +1,4 @@
1
+ export declare const BadgeStatus: ({ statusCode }: {
2
+ statusCode: number;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=badge-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge-status.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/views/admin/views/core/debug/system-logs/badges/badge-status.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,gBAAgB;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,4CAcjE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Badge } from "../../../../../../../components/ui/badge.js";
3
+ export const BadgeStatus = ({ statusCode })=>{
4
+ return /*#__PURE__*/ _jsx(Badge, {
5
+ variant: statusCode >= 200 && statusCode < 300 ? 'default' : statusCode >= 400 ? 'destructive' : 'secondary',
6
+ children: statusCode
7
+ });
8
+ };
@@ -0,0 +1,3 @@
1
+ import type { ContentMoreActionSystemLogs } from '../actions/more/content';
2
+ export declare const BadgeTypeLog: ({ type, }: Pick<React.ComponentProps<typeof ContentMoreActionSystemLogs>, "type">) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=badge-type-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge-type-log.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/views/admin/views/core/debug/system-logs/badges/badge-type-log.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,eAAO,MAAM,YAAY,GAAI,WAE1B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,2BAA2B,CAAC,EAAE,MAAM,CAAC,4CAoBxE,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TriangleAlertIcon, XIcon } from "lucide-react";
3
+ import { useTranslations } from "next-intl";
4
+ import { Badge } from "../../../../../../../components/ui/badge.js";
5
+ export const BadgeTypeLog = ({ type })=>{
6
+ const t = useTranslations('admin.debug.logs.types');
7
+ if (type === 'warn') {
8
+ return /*#__PURE__*/ _jsxs(Badge, {
9
+ className: "bg-warn/10 border-warn/50 text-warn",
10
+ children: [
11
+ /*#__PURE__*/ _jsx(TriangleAlertIcon, {}),
12
+ " ",
13
+ t(type)
14
+ ]
15
+ });
16
+ }
17
+ if (type === 'error') {
18
+ return /*#__PURE__*/ _jsxs(Badge, {
19
+ className: "bg-destructive/10 border-destructive/50 text-destructive",
20
+ children: [
21
+ /*#__PURE__*/ _jsx(XIcon, {}),
22
+ " ",
23
+ t(type)
24
+ ]
25
+ });
26
+ }
27
+ return /*#__PURE__*/ _jsx(Badge, {
28
+ children: t(type)
29
+ });
30
+ };
@@ -0,0 +1,31 @@
1
+ export declare const getSystemLogsData: (query: Record<string, string | string[] | undefined>) => Promise<{
2
+ edges: {
3
+ ipAddress: string;
4
+ user: {
5
+ id: number;
6
+ name: string;
7
+ nameCode: string;
8
+ } | null;
9
+ id: number;
10
+ createdAt: Date;
11
+ userAgent: string | null;
12
+ type: "warn" | "error" | "debug";
13
+ path: string;
14
+ pluginId: string;
15
+ content: string;
16
+ method: string;
17
+ statusCode: number;
18
+ }[];
19
+ pageInfo: {
20
+ count: number;
21
+ totalCount: number;
22
+ hasNextPage: boolean;
23
+ hasPreviousPage: boolean;
24
+ startCursor: number | null;
25
+ endCursor: number | null;
26
+ };
27
+ }>;
28
+ export declare const SystemLogsView: ({ searchParams, }: {
29
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
30
+ }) => Promise<import("react/jsx-runtime").JSX.Element>;
31
+ //# sourceMappingURL=system-logs-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-logs-view.d.ts","sourceRoot":"","sources":["../../../../../../../../src/views/admin/views/core/debug/system-logs/system-logs-view.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,iBAAiB,GAC5B,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;EAcrD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAU,mBAElC;IACD,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;CACtE,qDA8DA,CAAC"}
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getTranslations } from "next-intl/server";
3
+ import { debugAdminModule } from "../../../../../../api/modules/admin/debug/debug.admin.module.js";
4
+ import { DateFormat } from "../../../../../../components/date-format.js";
5
+ import { DataTable } from "../../../../../../components/table/data-table.js";
6
+ import { fetcher } from "../../../../../../lib/fetcher.js";
7
+ import { MoreActionSystemLogs } from "./actions/more/more.js";
8
+ import { BadgeStatus } from "./badges/badge-status.js";
9
+ import { BadgeTypeLog } from "./badges/badge-type-log.js";
10
+ export const getSystemLogsData = async (query)=>{
11
+ const res = await fetcher(debugAdminModule, {
12
+ prefixPath: '/admin',
13
+ path: '/logs',
14
+ method: 'get',
15
+ module: 'debug',
16
+ args: {
17
+ query
18
+ },
19
+ withPagination: true
20
+ });
21
+ return await res.json();
22
+ };
23
+ export const SystemLogsView = async ({ searchParams })=>{
24
+ const [t, query] = await Promise.all([
25
+ getTranslations('admin.debug.logs'),
26
+ searchParams
27
+ ]);
28
+ const data = await getSystemLogsData(query);
29
+ return /*#__PURE__*/ _jsx(DataTable, {
30
+ columns: [
31
+ {
32
+ id: 'pluginId',
33
+ label: t('plugin'),
34
+ className: 'w-48'
35
+ },
36
+ {
37
+ id: 'type',
38
+ label: t('type'),
39
+ cell: ({ row })=>/*#__PURE__*/ _jsx(BadgeTypeLog, {
40
+ type: row.type
41
+ })
42
+ },
43
+ {
44
+ id: 'statusCode',
45
+ label: t('status_code'),
46
+ className: 'w-26',
47
+ cell: ({ row })=>/*#__PURE__*/ _jsx(BadgeStatus, {
48
+ statusCode: row.statusCode
49
+ })
50
+ },
51
+ {
52
+ id: 'createdAt',
53
+ label: t('created_at'),
54
+ cell: ({ row })=>/*#__PURE__*/ _jsx(DateFormat, {
55
+ date: row.createdAt,
56
+ showFullDate: true
57
+ })
58
+ },
59
+ {
60
+ id: 'content',
61
+ label: t('content'),
62
+ cell: ({ row })=>{
63
+ const CHARACTERS = 50;
64
+ const content = row.content;
65
+ const isLong = content.length > CHARACTERS;
66
+ const displayContent = isLong ? content.slice(0, CHARACTERS) + '...' : content;
67
+ return /*#__PURE__*/ _jsx("span", {
68
+ children: displayContent
69
+ });
70
+ }
71
+ },
72
+ {
73
+ id: 'actions',
74
+ label: '',
75
+ cell: ({ row })=>/*#__PURE__*/ _jsx(MoreActionSystemLogs, {
76
+ ...row
77
+ })
78
+ }
79
+ ],
80
+ edges: data.edges.map((edge)=>({
81
+ ...edge
82
+ })),
83
+ order: {
84
+ columns: [
85
+ 'createdAt',
86
+ 'pluginId',
87
+ 'type'
88
+ ],
89
+ defaultOrder: {
90
+ column: 'createdAt',
91
+ order: 'desc'
92
+ }
93
+ },
94
+ pageInfo: data.pageInfo
95
+ });
96
+ };