react-native-xenon 0.1.0 → 0.2.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.
- package/README.md +5 -5
- package/lib/commonjs/hooks/useConsoleInterceptor.js +3 -4
- package/lib/commonjs/hooks/useConsoleInterceptor.js.map +1 -1
- package/lib/commonjs/hooks/useNetworkInterceptor.js +26 -22
- package/lib/commonjs/hooks/useNetworkInterceptor.js.map +1 -1
- package/lib/commonjs/interceptors/FetchInterceptor.js +5 -2
- package/lib/commonjs/interceptors/FetchInterceptor.js.map +1 -1
- package/lib/commonjs/interceptors/WebSocketInterceptor.js +11 -4
- package/lib/commonjs/interceptors/WebSocketInterceptor.js.map +1 -1
- package/lib/commonjs/interceptors/XHRInterceptor.js +4 -1
- package/lib/commonjs/interceptors/XHRInterceptor.js.map +1 -1
- package/lib/commonjs/types/index.js +8 -8
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/ui/Xenon.js +7 -5
- package/lib/commonjs/ui/Xenon.js.map +1 -1
- package/lib/commonjs/ui/components/details/NetworkRequestDetails.js +8 -5
- package/lib/commonjs/ui/components/details/NetworkRequestDetails.js.map +1 -1
- package/lib/commonjs/ui/components/headers/NetworkPanelHeader.js +11 -2
- package/lib/commonjs/ui/components/headers/NetworkPanelHeader.js.map +1 -1
- package/lib/commonjs/ui/components/index.js +2 -2
- package/lib/commonjs/ui/components/index.js.map +1 -1
- package/lib/commonjs/ui/components/items/NetworkPanelItem.js +12 -4
- package/lib/commonjs/ui/components/items/NetworkPanelItem.js.map +1 -1
- package/lib/commonjs/ui/components/panels/NetworkPanel.js +2 -1
- package/lib/commonjs/ui/components/panels/NetworkPanel.js.map +1 -1
- package/lib/commonjs/utils.js +7 -5
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/hooks/useConsoleInterceptor.js +3 -4
- package/lib/module/hooks/useConsoleInterceptor.js.map +1 -1
- package/lib/module/hooks/useNetworkInterceptor.js +15 -11
- package/lib/module/hooks/useNetworkInterceptor.js.map +1 -1
- package/lib/module/interceptors/FetchInterceptor.js +6 -3
- package/lib/module/interceptors/FetchInterceptor.js.map +1 -1
- package/lib/module/interceptors/WebSocketInterceptor.js +11 -4
- package/lib/module/interceptors/WebSocketInterceptor.js.map +1 -1
- package/lib/module/interceptors/XHRInterceptor.js +4 -1
- package/lib/module/interceptors/XHRInterceptor.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/ui/Xenon.js +7 -5
- package/lib/module/ui/Xenon.js.map +1 -1
- package/lib/module/ui/components/details/NetworkRequestDetails.js +9 -6
- package/lib/module/ui/components/details/NetworkRequestDetails.js.map +1 -1
- package/lib/module/ui/components/headers/NetworkPanelHeader.js +11 -2
- package/lib/module/ui/components/headers/NetworkPanelHeader.js.map +1 -1
- package/lib/module/ui/components/index.js +2 -2
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/components/items/NetworkPanelItem.js +13 -5
- package/lib/module/ui/components/items/NetworkPanelItem.js.map +1 -1
- package/lib/module/ui/components/panels/NetworkPanel.js +2 -1
- package/lib/module/ui/components/panels/NetworkPanel.js.map +1 -1
- package/lib/module/utils.js +3 -2
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/commonjs/src/contexts/MainContext.d.ts +1 -1
- package/lib/typescript/commonjs/src/contexts/MainContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useConsoleInterceptor.d.ts +2 -2
- package/lib/typescript/commonjs/src/hooks/useConsoleInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useNetworkInterceptor.d.ts +2 -2
- package/lib/typescript/commonjs/src/hooks/useNetworkInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/interceptors/FetchInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/interceptors/HttpInterceptor.d.ts +1 -1
- package/lib/typescript/commonjs/src/interceptors/WebSocketInterceptor.d.ts +3 -2
- package/lib/typescript/commonjs/src/interceptors/WebSocketInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/interceptors/XHRInterceptor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/common.d.ts +2 -0
- package/lib/typescript/commonjs/src/types/common.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/http.d.ts +1 -2
- package/lib/typescript/commonjs/src/types/http.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/websocket.d.ts +6 -7
- package/lib/typescript/commonjs/src/types/websocket.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/Xenon.d.ts +2 -2
- package/lib/typescript/commonjs/src/ui/Xenon.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/details/NetworkRequestDetails.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/headers/NetworkPanelHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/items/NetworkPanelItem.d.ts +5 -4
- package/lib/typescript/commonjs/src/ui/components/items/NetworkPanelItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ui/components/panels/NetworkPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils.d.ts +3 -2
- package/lib/typescript/commonjs/src/utils.d.ts.map +1 -1
- package/lib/typescript/module/src/contexts/MainContext.d.ts +1 -1
- package/lib/typescript/module/src/contexts/MainContext.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useConsoleInterceptor.d.ts +2 -2
- package/lib/typescript/module/src/hooks/useConsoleInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useNetworkInterceptor.d.ts +2 -2
- package/lib/typescript/module/src/hooks/useNetworkInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/interceptors/FetchInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/interceptors/HttpInterceptor.d.ts +1 -1
- package/lib/typescript/module/src/interceptors/WebSocketInterceptor.d.ts +3 -2
- package/lib/typescript/module/src/interceptors/WebSocketInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/interceptors/XHRInterceptor.d.ts.map +1 -1
- package/lib/typescript/module/src/types/common.d.ts +2 -0
- package/lib/typescript/module/src/types/common.d.ts.map +1 -1
- package/lib/typescript/module/src/types/http.d.ts +1 -2
- package/lib/typescript/module/src/types/http.d.ts.map +1 -1
- package/lib/typescript/module/src/types/index.d.ts +1 -1
- package/lib/typescript/module/src/types/index.d.ts.map +1 -1
- package/lib/typescript/module/src/types/websocket.d.ts +6 -7
- package/lib/typescript/module/src/types/websocket.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/Xenon.d.ts +2 -2
- package/lib/typescript/module/src/ui/Xenon.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/details/NetworkRequestDetails.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/headers/NetworkPanelHeader.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/index.d.ts +2 -2
- package/lib/typescript/module/src/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/items/NetworkPanelItem.d.ts +5 -4
- package/lib/typescript/module/src/ui/components/items/NetworkPanelItem.d.ts.map +1 -1
- package/lib/typescript/module/src/ui/components/panels/NetworkPanel.d.ts.map +1 -1
- package/lib/typescript/module/src/utils.d.ts +3 -2
- package/lib/typescript/module/src/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/contexts/MainContext.ts +1 -1
- package/src/global.d.ts +4 -4
- package/src/hooks/useConsoleInterceptor.ts +2 -4
- package/src/hooks/useNetworkInterceptor.ts +16 -10
- package/src/interceptors/FetchInterceptor.ts +6 -2
- package/src/interceptors/WebSocketInterceptor.ts +13 -4
- package/src/interceptors/XHRInterceptor.ts +6 -0
- package/src/types/common.ts +2 -0
- package/src/types/http.ts +1 -1
- package/src/types/index.ts +1 -1
- package/src/types/websocket.ts +6 -11
- package/src/ui/Xenon.tsx +9 -7
- package/src/ui/components/details/NetworkRequestDetails.tsx +19 -8
- package/src/ui/components/headers/NetworkPanelHeader.tsx +10 -2
- package/src/ui/components/index.ts +2 -2
- package/src/ui/components/items/NetworkPanelItem.tsx +25 -8
- package/src/ui/components/panels/NetworkPanel.tsx +2 -1
- package/src/utils.ts +5 -2
package/src/types/websocket.ts
CHANGED
@@ -2,12 +2,11 @@ import type { NetworkRequest, NetworkType } from './common';
|
|
2
2
|
|
3
3
|
export interface WebSocketRequest extends NetworkRequest {
|
4
4
|
type: NetworkType.WS;
|
5
|
-
|
6
|
-
protocols?: string | string[] | null;
|
5
|
+
protocols?: string | string[];
|
7
6
|
options?: {
|
8
7
|
headers: { [headerName: string]: string };
|
9
8
|
[optionName: string]: any;
|
10
|
-
}
|
9
|
+
};
|
11
10
|
messages?: string;
|
12
11
|
closeReason?: string;
|
13
12
|
serverError?: { message?: string };
|
@@ -16,7 +15,7 @@ export interface WebSocketRequest extends NetworkRequest {
|
|
16
15
|
|
17
16
|
export type WebSocketConnectCallback =
|
18
17
|
| ((
|
19
|
-
|
18
|
+
url: string,
|
20
19
|
protocols?: WebSocketRequest['protocols'],
|
21
20
|
options?: WebSocketRequest['options'],
|
22
21
|
socketId?: number,
|
@@ -26,19 +25,15 @@ export type WebSocketConnectCallback =
|
|
26
25
|
export type WebSocketSendCallback = ((data: string, socketId: number) => void) | null;
|
27
26
|
|
28
27
|
export type WebSocketCloseCallback =
|
29
|
-
| ((
|
30
|
-
code: WebSocketRequest['status'],
|
31
|
-
reason: WebSocketRequest['closeReason'],
|
32
|
-
socketId: number,
|
33
|
-
) => void)
|
28
|
+
| ((code: number, reason: string, socketId: number) => void)
|
34
29
|
| null;
|
35
30
|
|
36
|
-
export type WebSocketOnOpenCallback = ((socketId: number) => void) | null;
|
31
|
+
export type WebSocketOnOpenCallback = ((socketId: number, duration: number) => void) | null;
|
37
32
|
|
38
33
|
export type WebSocketOnMessageCallback = ((socketId: number, message: any) => void) | null;
|
39
34
|
|
40
35
|
export type WebSocketOnErrorCallback =
|
41
|
-
| ((socketId: number,
|
36
|
+
| ((socketId: number, error: WebSocketRequest['serverError']) => void)
|
42
37
|
| null;
|
43
38
|
|
44
39
|
export type WebSocketOnCloseCallback =
|
package/src/ui/Xenon.tsx
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
import { enableMapSet } from 'immer';
|
1
2
|
import { createRef, useImperativeHandle, useRef, useState, type JSX } from 'react';
|
2
3
|
import { Animated, SafeAreaView, StyleSheet, useWindowDimensions, View } from 'react-native';
|
4
|
+
import MainContext, { type MainContextValue } from '../contexts/MainContext';
|
3
5
|
import { useConsoleInterceptor, useNetworkInterceptor } from '../hooks';
|
4
6
|
import { DebuggerPanel, type DebuggerPosition, type DebuggerVisibility } from '../types';
|
5
7
|
import { Bubble, ConsolePanel, DebuggerHeader, DetailsViewer, NetworkPanel } from './components';
|
6
|
-
import MainContext, { type MainContextValue } from '../contexts/MainContext';
|
7
8
|
|
8
9
|
interface XenonComponentMethods {
|
9
10
|
show(): void;
|
@@ -11,8 +12,8 @@ interface XenonComponentMethods {
|
|
11
12
|
}
|
12
13
|
|
13
14
|
interface XenonComponentProps {
|
14
|
-
|
15
|
-
|
15
|
+
autoInspectNetworkEnabled?: boolean;
|
16
|
+
autoInspectConsoleEnabled?: boolean;
|
16
17
|
bubbleSize?: number;
|
17
18
|
}
|
18
19
|
|
@@ -20,11 +21,12 @@ interface ReactNativeXenon extends XenonComponentMethods {
|
|
20
21
|
Component(props: XenonComponentProps): JSX.Element;
|
21
22
|
}
|
22
23
|
|
24
|
+
enableMapSet();
|
23
25
|
const rootRef = createRef<XenonComponentMethods>();
|
24
26
|
|
25
27
|
function XenonComponent({
|
26
|
-
|
27
|
-
|
28
|
+
autoInspectNetworkEnabled = true,
|
29
|
+
autoInspectConsoleEnabled = true,
|
28
30
|
bubbleSize = 40,
|
29
31
|
}: XenonComponentProps) {
|
30
32
|
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
@@ -41,11 +43,11 @@ function XenonComponent({
|
|
41
43
|
const [panelSelected, setPanelSelected] = useState<DebuggerPanel | null>(DebuggerPanel.Network);
|
42
44
|
|
43
45
|
const networkInterceptor = useNetworkInterceptor({
|
44
|
-
autoEnabled:
|
46
|
+
autoEnabled: autoInspectNetworkEnabled,
|
45
47
|
});
|
46
48
|
|
47
49
|
const logInterceptor = useConsoleInterceptor({
|
48
|
-
autoEnabled:
|
50
|
+
autoEnabled: autoInspectConsoleEnabled,
|
49
51
|
});
|
50
52
|
|
51
53
|
useImperativeHandle(
|
@@ -7,7 +7,13 @@ import {
|
|
7
7
|
type NetworkTab,
|
8
8
|
type WebSocketRequest,
|
9
9
|
} from '../../../types';
|
10
|
-
import {
|
10
|
+
import {
|
11
|
+
convertToCurl,
|
12
|
+
formatRequestDuration,
|
13
|
+
formatRequestMethod,
|
14
|
+
formatRequestStatusCode,
|
15
|
+
limitChar,
|
16
|
+
} from '../../../utils';
|
11
17
|
import NetworkDetailsHeader from '../headers/NetworkRequestDetailsHeader';
|
12
18
|
import NetworkRequestDetailsItem from '../items/NetworkRequestDetailsItem';
|
13
19
|
|
@@ -20,9 +26,9 @@ export default function NetworkRequestDetails({ item }: NetworkRequestDetailsPro
|
|
20
26
|
|
21
27
|
const isWebSocket = item.type === NetworkType.WS;
|
22
28
|
|
23
|
-
const requestUrl = new URL(
|
29
|
+
const requestUrl = new URL(item.url);
|
24
30
|
|
25
|
-
const headerShown =
|
31
|
+
const headerShown = !!item.url;
|
26
32
|
const queryStringParametersShown = !!requestUrl.search;
|
27
33
|
const bodyShown = !isWebSocket && !!item.body;
|
28
34
|
const responseShown = !isWebSocket && !!item.response;
|
@@ -41,17 +47,22 @@ export default function NetworkRequestDetails({ item }: NetworkRequestDetailsPro
|
|
41
47
|
<>
|
42
48
|
<NetworkRequestDetailsItem label="Request Type" content={item.type} />
|
43
49
|
|
50
|
+
<NetworkRequestDetailsItem label="Request URL" content={item.url} />
|
51
|
+
|
44
52
|
<NetworkRequestDetailsItem
|
45
|
-
label="Request
|
46
|
-
content={isWebSocket ?
|
53
|
+
label="Request Method"
|
54
|
+
content={formatRequestMethod(isWebSocket ? undefined : item.method)}
|
47
55
|
/>
|
48
56
|
|
49
57
|
<NetworkRequestDetailsItem
|
50
|
-
label="
|
51
|
-
content={
|
58
|
+
label="Duration"
|
59
|
+
content={formatRequestDuration(item.duration)}
|
52
60
|
/>
|
53
61
|
|
54
|
-
<NetworkRequestDetailsItem
|
62
|
+
<NetworkRequestDetailsItem
|
63
|
+
label="Status Code"
|
64
|
+
content={formatRequestStatusCode(item.status)}
|
65
|
+
/>
|
55
66
|
|
56
67
|
{isWebSocket && (
|
57
68
|
<NetworkRequestDetailsItem label="Headers" content={limitChar(item.options?.headers)} />
|
@@ -3,6 +3,14 @@ import { StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
export default function NetworkPanelHeader() {
|
4
4
|
return (
|
5
5
|
<View style={styles.container}>
|
6
|
+
<View style={styles.headerColumn}>
|
7
|
+
<Text numberOfLines={1} style={styles.itemText}>
|
8
|
+
Method
|
9
|
+
</Text>
|
10
|
+
</View>
|
11
|
+
|
12
|
+
<View style={styles.divider} />
|
13
|
+
|
6
14
|
<View style={[styles.headerColumn, styles.headerMainColumn]}>
|
7
15
|
<Text numberOfLines={1} style={styles.itemText}>
|
8
16
|
Name
|
@@ -13,7 +21,7 @@ export default function NetworkPanelHeader() {
|
|
13
21
|
|
14
22
|
<View style={styles.headerColumn}>
|
15
23
|
<Text numberOfLines={1} style={styles.itemText}>
|
16
|
-
|
24
|
+
Duration
|
17
25
|
</Text>
|
18
26
|
</View>
|
19
27
|
|
@@ -37,7 +45,7 @@ const styles = StyleSheet.create({
|
|
37
45
|
borderRadius: 4,
|
38
46
|
},
|
39
47
|
headerMainColumn: {
|
40
|
-
flex:
|
48
|
+
flex: 5.5,
|
41
49
|
flexShrink: 1,
|
42
50
|
},
|
43
51
|
headerColumn: {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export { default as Bubble } from './bubble/Bubble';
|
2
|
+
export { default as DetailsViewer } from './details/DetailsViewer';
|
2
3
|
export { default as DebuggerHeader } from './headers/DebuggerHeader';
|
3
|
-
export { default as NetworkPanel } from './panels/NetworkPanel';
|
4
4
|
export { default as ConsolePanel } from './panels/ConsolePanel';
|
5
|
-
export { default as
|
5
|
+
export { default as NetworkPanel } from './panels/NetworkPanel';
|
@@ -1,17 +1,28 @@
|
|
1
1
|
import { useMemo } from 'react';
|
2
2
|
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
3
3
|
import { URL } from 'react-native-url-polyfill';
|
4
|
-
import type { HttpRequest,
|
5
|
-
import {
|
4
|
+
import type { HttpRequest, NetworkRequest } from '../../../types';
|
5
|
+
import {
|
6
|
+
formatRequestDuration,
|
7
|
+
formatRequestMethod,
|
8
|
+
formatRequestStatusCode,
|
9
|
+
} from '../../../utils';
|
6
10
|
|
7
11
|
interface NetworkPanelItemProps {
|
8
|
-
name: HttpRequest['url'] | WebSocketRequest['uri'];
|
9
12
|
method?: HttpRequest['method'];
|
10
|
-
|
13
|
+
name: NetworkRequest['url'];
|
14
|
+
duration?: NetworkRequest['duration'];
|
15
|
+
status?: NetworkRequest['status'];
|
11
16
|
onPress: () => void;
|
12
17
|
}
|
13
18
|
|
14
|
-
export default function NetworkPanelItem({
|
19
|
+
export default function NetworkPanelItem({
|
20
|
+
method,
|
21
|
+
name,
|
22
|
+
duration,
|
23
|
+
status,
|
24
|
+
onPress,
|
25
|
+
}: NetworkPanelItemProps) {
|
15
26
|
const requestName = useMemo(() => {
|
16
27
|
if (!name) return '[failed]';
|
17
28
|
|
@@ -28,6 +39,12 @@ export default function NetworkPanelItem({ name, status, method, onPress }: Netw
|
|
28
39
|
|
29
40
|
return (
|
30
41
|
<TouchableOpacity onPress={onPress} style={styles.container}>
|
42
|
+
<View style={styles.column}>
|
43
|
+
<Text numberOfLines={1} style={styles.text}>
|
44
|
+
{formatRequestMethod(method)}
|
45
|
+
</Text>
|
46
|
+
</View>
|
47
|
+
|
31
48
|
<View style={[styles.column, styles.mainColumn]}>
|
32
49
|
<Text numberOfLines={1} style={styles.text}>
|
33
50
|
{requestName}
|
@@ -36,13 +53,13 @@ export default function NetworkPanelItem({ name, status, method, onPress }: Netw
|
|
36
53
|
|
37
54
|
<View style={styles.column}>
|
38
55
|
<Text numberOfLines={1} style={styles.text}>
|
39
|
-
{
|
56
|
+
{formatRequestDuration(duration)}
|
40
57
|
</Text>
|
41
58
|
</View>
|
42
59
|
|
43
60
|
<View style={styles.column}>
|
44
61
|
<Text numberOfLines={1} style={styles.text}>
|
45
|
-
{
|
62
|
+
{formatRequestStatusCode(status)}
|
46
63
|
</Text>
|
47
64
|
</View>
|
48
65
|
</TouchableOpacity>
|
@@ -55,7 +72,7 @@ const styles = StyleSheet.create({
|
|
55
72
|
flexDirection: 'row',
|
56
73
|
},
|
57
74
|
mainColumn: {
|
58
|
-
flex:
|
75
|
+
flex: 5.5,
|
59
76
|
flexShrink: 1,
|
60
77
|
},
|
61
78
|
column: {
|
@@ -28,8 +28,9 @@ export default function NetworkPanel() {
|
|
28
28
|
|
29
29
|
return (
|
30
30
|
<NetworkPanelItem
|
31
|
-
name={isWebSocket ? item.uri : item.url}
|
32
31
|
method={isWebSocket ? undefined : item.method}
|
32
|
+
name={item.url}
|
33
|
+
duration={item.duration}
|
33
34
|
status={item.status}
|
34
35
|
onPress={onPress}
|
35
36
|
/>
|
package/src/utils.ts
CHANGED
@@ -17,9 +17,12 @@ export const getHttpInterceptorId = () => {
|
|
17
17
|
export const keyValueToString = (key: string, value: any): string =>
|
18
18
|
`${key}: ${limitChar(value)}\n`;
|
19
19
|
|
20
|
-
export const
|
20
|
+
export const formatRequestMethod = (method?: string) => method ?? 'GET';
|
21
21
|
|
22
|
-
export const
|
22
|
+
export const formatRequestDuration = (duration?: number) =>
|
23
|
+
duration ? `${duration}ms` : 'pending';
|
24
|
+
|
25
|
+
export const formatRequestStatusCode = (statusCode?: number) => `${statusCode ?? 'pending'}`;
|
23
26
|
|
24
27
|
export const formatLogMessage = (type: string, values: any[]) => {
|
25
28
|
const message: string = values.reduce((pre, cur, index, array) => {
|