network-terminal 1.0.0

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.
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+
3
+ interface NetworkLog {
4
+ id: string;
5
+ timestamp: Date;
6
+ method: string;
7
+ url: string;
8
+ status?: number;
9
+ statusText?: string;
10
+ requestHeaders?: Record<string, string>;
11
+ requestBody?: unknown;
12
+ responseBody?: unknown;
13
+ duration?: number;
14
+ error?: string;
15
+ type: 'fetch' | 'xhr';
16
+ }
17
+ interface TerminalProps {
18
+ title: string;
19
+ logs: NetworkLog[];
20
+ type: 'request' | 'response';
21
+ onClear: () => void;
22
+ expanded: boolean;
23
+ onToggleExpand: () => void;
24
+ }
25
+ interface LogEntryProps {
26
+ log: NetworkLog;
27
+ type: 'request' | 'response';
28
+ }
29
+ interface TerminalHeaderProps {
30
+ title: string;
31
+ count: number;
32
+ expanded: boolean;
33
+ onClear: () => void;
34
+ onToggleExpand: () => void;
35
+ }
36
+ interface UseNetworkInterceptorProps {
37
+ enabled: boolean;
38
+ onLogAdd: (log: NetworkLog) => void;
39
+ onLogUpdate: (id: string, updates: Partial<NetworkLog>) => void;
40
+ }
41
+ interface NetworkTerminalProps {
42
+ maxLogs?: number;
43
+ defaultVisible?: boolean;
44
+ position?: 'bottom' | 'top';
45
+ height?: string;
46
+ zIndex?: number;
47
+ }
48
+
49
+ declare const NetworkTerminal: React.FC<NetworkTerminalProps>;
50
+
51
+ declare const Terminal: React.FC<TerminalProps>;
52
+
53
+ declare const TerminalHeader: React.FC<TerminalHeaderProps>;
54
+
55
+ declare const LogEntry: React.FC<LogEntryProps>;
56
+
57
+ declare const useNetworkInterceptor: ({ enabled, onLogAdd, onLogUpdate, }: UseNetworkInterceptorProps) => void;
58
+
59
+ declare const formatJson: (data: unknown) => string;
60
+ declare const truncate: (str: string, maxLength: number) => string;
61
+ declare const formatTime: (date: Date) => string;
62
+
63
+ declare const getStatusColor: (status?: number) => string;
64
+ declare const getMethodColor: (method: string) => string;
65
+
66
+ export { LogEntry, type LogEntryProps, type NetworkLog, NetworkTerminal, type NetworkTerminalProps, Terminal, TerminalHeader, type TerminalHeaderProps, type TerminalProps, type UseNetworkInterceptorProps, formatJson, formatTime, getMethodColor, getStatusColor, truncate, useNetworkInterceptor };
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+
3
+ interface NetworkLog {
4
+ id: string;
5
+ timestamp: Date;
6
+ method: string;
7
+ url: string;
8
+ status?: number;
9
+ statusText?: string;
10
+ requestHeaders?: Record<string, string>;
11
+ requestBody?: unknown;
12
+ responseBody?: unknown;
13
+ duration?: number;
14
+ error?: string;
15
+ type: 'fetch' | 'xhr';
16
+ }
17
+ interface TerminalProps {
18
+ title: string;
19
+ logs: NetworkLog[];
20
+ type: 'request' | 'response';
21
+ onClear: () => void;
22
+ expanded: boolean;
23
+ onToggleExpand: () => void;
24
+ }
25
+ interface LogEntryProps {
26
+ log: NetworkLog;
27
+ type: 'request' | 'response';
28
+ }
29
+ interface TerminalHeaderProps {
30
+ title: string;
31
+ count: number;
32
+ expanded: boolean;
33
+ onClear: () => void;
34
+ onToggleExpand: () => void;
35
+ }
36
+ interface UseNetworkInterceptorProps {
37
+ enabled: boolean;
38
+ onLogAdd: (log: NetworkLog) => void;
39
+ onLogUpdate: (id: string, updates: Partial<NetworkLog>) => void;
40
+ }
41
+ interface NetworkTerminalProps {
42
+ maxLogs?: number;
43
+ defaultVisible?: boolean;
44
+ position?: 'bottom' | 'top';
45
+ height?: string;
46
+ zIndex?: number;
47
+ }
48
+
49
+ declare const NetworkTerminal: React.FC<NetworkTerminalProps>;
50
+
51
+ declare const Terminal: React.FC<TerminalProps>;
52
+
53
+ declare const TerminalHeader: React.FC<TerminalHeaderProps>;
54
+
55
+ declare const LogEntry: React.FC<LogEntryProps>;
56
+
57
+ declare const useNetworkInterceptor: ({ enabled, onLogAdd, onLogUpdate, }: UseNetworkInterceptorProps) => void;
58
+
59
+ declare const formatJson: (data: unknown) => string;
60
+ declare const truncate: (str: string, maxLength: number) => string;
61
+ declare const formatTime: (date: Date) => string;
62
+
63
+ declare const getStatusColor: (status?: number) => string;
64
+ declare const getMethodColor: (method: string) => string;
65
+
66
+ export { LogEntry, type LogEntryProps, type NetworkLog, NetworkTerminal, type NetworkTerminalProps, Terminal, TerminalHeader, type TerminalHeaderProps, type TerminalProps, type UseNetworkInterceptorProps, formatJson, formatTime, getMethodColor, getStatusColor, truncate, useNetworkInterceptor };