@buoy-gg/network 1.7.2
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 +381 -0
- package/lib/commonjs/index.js +34 -0
- package/lib/commonjs/network/components/NetworkCopySettingsView.js +867 -0
- package/lib/commonjs/network/components/NetworkEventDetailView.js +837 -0
- package/lib/commonjs/network/components/NetworkEventItemCompact.js +323 -0
- package/lib/commonjs/network/components/NetworkFilterViewV3.js +297 -0
- package/lib/commonjs/network/components/NetworkModal.js +937 -0
- package/lib/commonjs/network/hooks/useNetworkEvents.js +320 -0
- package/lib/commonjs/network/hooks/useTickEveryMinute.js +34 -0
- package/lib/commonjs/network/index.js +102 -0
- package/lib/commonjs/network/types/index.js +1 -0
- package/lib/commonjs/network/utils/extractOperationName.js +80 -0
- package/lib/commonjs/network/utils/formatGraphQLVariables.js +219 -0
- package/lib/commonjs/network/utils/formatting.js +30 -0
- package/lib/commonjs/network/utils/networkEventStore.js +269 -0
- package/lib/commonjs/network/utils/networkListener.js +801 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +83 -0
- package/lib/module/index.js +7 -0
- package/lib/module/network/components/NetworkCopySettingsView.js +862 -0
- package/lib/module/network/components/NetworkEventDetailView.js +834 -0
- package/lib/module/network/components/NetworkEventItemCompact.js +320 -0
- package/lib/module/network/components/NetworkFilterViewV3.js +293 -0
- package/lib/module/network/components/NetworkModal.js +933 -0
- package/lib/module/network/hooks/useNetworkEvents.js +316 -0
- package/lib/module/network/hooks/useTickEveryMinute.js +29 -0
- package/lib/module/network/index.js +20 -0
- package/lib/module/network/types/index.js +1 -0
- package/lib/module/network/utils/extractOperationName.js +76 -0
- package/lib/module/network/utils/formatGraphQLVariables.js +213 -0
- package/lib/module/network/utils/formatting.js +9 -0
- package/lib/module/network/utils/networkEventStore.js +265 -0
- package/lib/module/network/utils/networkListener.js +791 -0
- package/lib/module/preset.js +79 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkCopySettingsView.d.ts +26 -0
- package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkEventDetailView.d.ts +13 -0
- package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkEventItemCompact.d.ts +12 -0
- package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkFilterViewV3.d.ts +22 -0
- package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkModal.d.ts +14 -0
- package/lib/typescript/network/components/NetworkModal.d.ts.map +1 -0
- package/lib/typescript/network/hooks/useNetworkEvents.d.ts +72 -0
- package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +1 -0
- package/lib/typescript/network/hooks/useTickEveryMinute.d.ts +9 -0
- package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +1 -0
- package/lib/typescript/network/index.d.ts +12 -0
- package/lib/typescript/network/index.d.ts.map +1 -0
- package/lib/typescript/network/types/index.d.ts +88 -0
- package/lib/typescript/network/types/index.d.ts.map +1 -0
- package/lib/typescript/network/utils/extractOperationName.d.ts +41 -0
- package/lib/typescript/network/utils/extractOperationName.d.ts.map +1 -0
- package/lib/typescript/network/utils/formatGraphQLVariables.d.ts +79 -0
- package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +1 -0
- package/lib/typescript/network/utils/formatting.d.ts +6 -0
- package/lib/typescript/network/utils/formatting.d.ts.map +1 -0
- package/lib/typescript/network/utils/networkEventStore.d.ts +81 -0
- package/lib/typescript/network/utils/networkEventStore.d.ts.map +1 -0
- package/lib/typescript/network/utils/networkListener.d.ts +191 -0
- package/lib/typescript/network/utils/networkListener.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts +76 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pre-configured network monitoring tool for FloatingDevTools
|
|
5
|
+
*
|
|
6
|
+
* This preset provides a zero-config way to add network request monitoring to your dev tools.
|
|
7
|
+
* Just import and add it to your apps array!
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { networkToolPreset } from '@buoy-gg/network';
|
|
12
|
+
*
|
|
13
|
+
* const installedApps = [
|
|
14
|
+
* networkToolPreset, // That's it!
|
|
15
|
+
* // ...other tools
|
|
16
|
+
* ];
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { NetworkIcon } from "@buoy-gg/shared-ui";
|
|
21
|
+
import { NetworkModal } from "./network/components/NetworkModal";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Pre-configured network monitoring tool for FloatingDevTools.
|
|
25
|
+
* Includes:
|
|
26
|
+
* - Live network request monitoring
|
|
27
|
+
* - Request/response inspection
|
|
28
|
+
* - Filter by status, method, URL
|
|
29
|
+
* - Timing information
|
|
30
|
+
*/
|
|
31
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
|
+
export const networkToolPreset = {
|
|
33
|
+
id: "network",
|
|
34
|
+
name: "NET",
|
|
35
|
+
description: "Network request logger",
|
|
36
|
+
slot: "both",
|
|
37
|
+
icon: ({
|
|
38
|
+
size
|
|
39
|
+
}) => /*#__PURE__*/_jsx(NetworkIcon, {
|
|
40
|
+
size: size
|
|
41
|
+
}),
|
|
42
|
+
component: NetworkModal,
|
|
43
|
+
props: {
|
|
44
|
+
enableSharedModalDimensions: false
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Create a custom network monitoring tool configuration.
|
|
50
|
+
* Use this if you want to override default settings.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* import { createNetworkTool } from '@buoy-gg/network';
|
|
55
|
+
*
|
|
56
|
+
* const myNetworkTool = createNetworkTool({
|
|
57
|
+
* name: "REQUESTS",
|
|
58
|
+
* iconColor: "#9945FF", // Purple color
|
|
59
|
+
* enableSharedModalDimensions: true,
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function createNetworkTool(options) {
|
|
64
|
+
return {
|
|
65
|
+
id: options?.id || "network",
|
|
66
|
+
name: options?.name || "NET",
|
|
67
|
+
description: options?.description || "Network request logger",
|
|
68
|
+
slot: "both",
|
|
69
|
+
icon: ({
|
|
70
|
+
size
|
|
71
|
+
}) => /*#__PURE__*/_jsx(NetworkIcon, {
|
|
72
|
+
size: size
|
|
73
|
+
}),
|
|
74
|
+
component: NetworkModal,
|
|
75
|
+
props: {
|
|
76
|
+
enableSharedModalDimensions: options?.enableSharedModalDimensions !== undefined ? options.enableSharedModalDimensions : false
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGhE,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { NetworkEvent } from "../types";
|
|
2
|
+
export interface CopySettings {
|
|
3
|
+
includeMethod: boolean;
|
|
4
|
+
includeStatus: boolean;
|
|
5
|
+
includeDuration: boolean;
|
|
6
|
+
includeTimestamp: boolean;
|
|
7
|
+
includeClient: boolean;
|
|
8
|
+
includeSizes: boolean;
|
|
9
|
+
includeErrors: boolean;
|
|
10
|
+
includeRequestHeaders: boolean;
|
|
11
|
+
includeResponseHeaders: boolean;
|
|
12
|
+
includeRequestBody: boolean;
|
|
13
|
+
includeResponseBody: boolean;
|
|
14
|
+
bodySizeThreshold: 10 | 50 | 100 | -1;
|
|
15
|
+
format: "markdown" | "json" | "plaintext";
|
|
16
|
+
filterMode: "all" | "failed" | "success";
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_COPY_SETTINGS: CopySettings;
|
|
19
|
+
interface NetworkCopySettingsViewProps {
|
|
20
|
+
settings: CopySettings;
|
|
21
|
+
onSettingsChange: (settings: CopySettings) => void;
|
|
22
|
+
events?: NetworkEvent[];
|
|
23
|
+
}
|
|
24
|
+
export declare function NetworkCopySettingsView({ settings, onSettingsChange, events, }: NetworkCopySettingsViewProps): import("react").JSX.Element;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=NetworkCopySettingsView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkCopySettingsView.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkCopySettingsView.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,MAAM,WAAW,YAAY;IAE3B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IAGvB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,OAAO,CAAC;IAGhC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;IAGtC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;IAG1C,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC1C;AAED,eAAO,MAAM,qBAAqB,EAAE,YAenC,CAAC;AAsEF,UAAU,4BAA4B;IACpC,QAAQ,EAAE,YAAY,CAAC;IACvB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACzB;AAwBD,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,gBAAgB,EAChB,MAAW,GACZ,EAAE,4BAA4B,+BAssB9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NetworkEvent } from "../types";
|
|
2
|
+
interface NetworkEventDetailViewProps {
|
|
3
|
+
event: NetworkEvent;
|
|
4
|
+
ignoredPatterns?: Set<string>;
|
|
5
|
+
onTogglePattern?: (pattern: string) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Detailed inspector rendering request/response metadata for a single network event. Designed to
|
|
9
|
+
* mimic Sentry’s layout with collapsible sections, diff views, and quick copy affordances.
|
|
10
|
+
*/
|
|
11
|
+
export declare function NetworkEventDetailView({ event, ignoredPatterns, onTogglePattern, }: NetworkEventDetailViewProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=NetworkEventDetailView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkEventDetailView.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkEventDetailView.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAU7C,UAAU,2BAA2B;IACnC,KAAK,EAAE,YAAY,CAAC;IACpB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAmKD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,eAA2B,EAC3B,eAA0B,GAC3B,EAAE,2BAA2B,+BA2Y7B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NetworkEvent } from "../types";
|
|
2
|
+
interface NetworkEventItemCompactProps {
|
|
3
|
+
event: NetworkEvent;
|
|
4
|
+
onPress: (event: NetworkEvent) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Compact list-row representation of a network event. Optimized for large lists with memoization
|
|
8
|
+
* and periodic refresh via `useTickEveryMinute` to keep relative timestamps accurate.
|
|
9
|
+
*/
|
|
10
|
+
export declare const NetworkEventItemCompact: import("react").NamedExoticComponent<NetworkEventItemCompactProps>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=NetworkEventItemCompact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkEventItemCompact.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkEventItemCompact.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAM7C,UAAU,4BAA4B;IACpC,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CACxC;AA8FD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,oEAoInC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { NetworkEvent } from "../types";
|
|
2
|
+
interface NetworkFilter {
|
|
3
|
+
status?: "all" | "success" | "error" | "pending";
|
|
4
|
+
method?: string[];
|
|
5
|
+
contentType?: string[];
|
|
6
|
+
searchText?: string;
|
|
7
|
+
}
|
|
8
|
+
interface NetworkFilterViewV3Props {
|
|
9
|
+
events: NetworkEvent[];
|
|
10
|
+
filter: NetworkFilter;
|
|
11
|
+
onFilterChange: (filter: NetworkFilter) => void;
|
|
12
|
+
ignoredPatterns?: Set<string>;
|
|
13
|
+
onTogglePattern?: (pattern: string) => void;
|
|
14
|
+
onAddPattern?: (pattern: string) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Control panel for filtering captured network events by status, method, host, and content type.
|
|
18
|
+
* Provides quick toggles, stats, and ignored-pattern management reminiscent of desktop tooling.
|
|
19
|
+
*/
|
|
20
|
+
export declare function NetworkFilterViewV3({ events, filter, onFilterChange, ignoredPatterns, onTogglePattern, onAddPattern, }: NetworkFilterViewV3Props): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=NetworkFilterViewV3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkFilterViewV3.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkFilterViewV3.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACjD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,wBAAwB;IAChC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,cAAc,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AA8DD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAM,EACN,cAAc,EACd,eAA2B,EAC3B,eAA0B,EAC1B,YAAuB,GACxB,EAAE,wBAAwB,+BAsQ1B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface NetworkModalProps {
|
|
2
|
+
visible: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onBack?: () => void;
|
|
5
|
+
onMinimize?: (modalState: any) => void;
|
|
6
|
+
enableSharedModalDimensions?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* High-level modal surface that wraps the network monitoring experience with shared timing
|
|
10
|
+
* context. Automatically injects the `TickProvider` so timestamps refresh while the modal is open.
|
|
11
|
+
*/
|
|
12
|
+
export declare function NetworkModal(props: NetworkModalProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=NetworkModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkModal.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkModal.tsx"],"names":[],"mappings":"AA2CA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAihCD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAMpD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for accessing network events and controls
|
|
3
|
+
* Uses Reactotron-style listener pattern
|
|
4
|
+
*/
|
|
5
|
+
import type { NetworkEvent, NetworkStats, NetworkFilter } from "../types";
|
|
6
|
+
/** Free tier limit for network requests */
|
|
7
|
+
export declare const FREE_TIER_REQUEST_LIMIT = 25;
|
|
8
|
+
/**
|
|
9
|
+
* Custom hook for accessing network events and controls
|
|
10
|
+
*
|
|
11
|
+
* This hook provides a complete interface for network monitoring, including
|
|
12
|
+
* event filtering, statistics calculation, and interception control. It uses
|
|
13
|
+
* the Reactotron-style listener pattern for network event handling.
|
|
14
|
+
*
|
|
15
|
+
* @returns Object containing filtered events, statistics, controls, and utilities
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* function NetworkMonitor() {
|
|
20
|
+
* const {
|
|
21
|
+
* events,
|
|
22
|
+
* stats,
|
|
23
|
+
* filter,
|
|
24
|
+
* setFilter,
|
|
25
|
+
* clearEvents,
|
|
26
|
+
* toggleInterception,
|
|
27
|
+
* isEnabled
|
|
28
|
+
* } = useNetworkEvents();
|
|
29
|
+
*
|
|
30
|
+
* return (
|
|
31
|
+
* <div>
|
|
32
|
+
* <p>Total requests: {stats.totalRequests}</p>
|
|
33
|
+
* <p>Success rate: {stats.successfulRequests}/{stats.totalRequests}</p>
|
|
34
|
+
* <button onClick={toggleInterception}>
|
|
35
|
+
* {isEnabled ? 'Stop' : 'Start'} Monitoring
|
|
36
|
+
* </button>
|
|
37
|
+
* </div>
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @performance Uses memoization for expensive filtering and statistics calculations
|
|
43
|
+
* @performance Optimizes string operations and array processing for large datasets
|
|
44
|
+
* @performance Includes Set-based lookups for O(1) filter matching
|
|
45
|
+
*
|
|
46
|
+
* @param options.isPro - Whether user has Pro access (unlimited events). Defaults to false (limited to FREE_TIER_REQUEST_LIMIT)
|
|
47
|
+
*/
|
|
48
|
+
export declare function useNetworkEvents(options?: {
|
|
49
|
+
isPro?: boolean;
|
|
50
|
+
}): {
|
|
51
|
+
/** Filtered events (all shown, but some may be locked for free users) */
|
|
52
|
+
events: NetworkEvent[];
|
|
53
|
+
/** All events before filtering (for stats) */
|
|
54
|
+
allEvents: NetworkEvent[];
|
|
55
|
+
stats: NetworkStats;
|
|
56
|
+
filter: NetworkFilter;
|
|
57
|
+
setFilter: import("react").Dispatch<import("react").SetStateAction<NetworkFilter>>;
|
|
58
|
+
clearEvents: () => void;
|
|
59
|
+
isEnabled: boolean;
|
|
60
|
+
toggleInterception: () => void;
|
|
61
|
+
hosts: string[];
|
|
62
|
+
methods: string[];
|
|
63
|
+
/** Whether there are locked events due to free tier limit */
|
|
64
|
+
hasLockedEvents: boolean;
|
|
65
|
+
/** Number of events locked due to free tier limit */
|
|
66
|
+
lockedEventCount: number;
|
|
67
|
+
/** Check if a specific event is locked (by ID) */
|
|
68
|
+
isEventLocked: (eventId: string) => boolean;
|
|
69
|
+
/** Free tier request limit */
|
|
70
|
+
requestLimit: number;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=useNetworkEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNetworkEvents.d.ts","sourceRoot":"","sources":["../../../../src/network/hooks/useNetworkEvents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG1E,2CAA2C;AAC3C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO;IAuR9D,yEAAyE;;IAEzE,8CAA8C;;;;;;;;;;IAU9C,6DAA6D;;IAE7D,qDAAqD;;IAErD,kDAAkD;6BAzFR,MAAM;IA2FhD,8BAA8B;;EAGjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
interface TickProviderProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
intervalMs?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function TickProvider({ children, intervalMs, }: TickProviderProps): import("react").JSX.Element;
|
|
7
|
+
export declare function useTickEveryMinute(): number;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=useTickEveryMinute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTickEveryMinute.d.ts","sourceRoot":"","sources":["../../../../src/network/hooks/useTickEveryMinute.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,UAAU,iBAAiB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,UAAmB,GACpB,EAAE,iBAAiB,+BAcnB;AAED,wBAAgB,kBAAkB,WAKjC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network monitoring section for React Native dev tools
|
|
3
|
+
*/
|
|
4
|
+
export { NetworkModal } from "./components/NetworkModal";
|
|
5
|
+
export { NetworkEventDetailView } from "./components/NetworkEventDetailView";
|
|
6
|
+
export { NetworkEventItemCompact } from "./components/NetworkEventItemCompact";
|
|
7
|
+
export { useNetworkEvents } from "./hooks/useNetworkEvents";
|
|
8
|
+
export { networkListener, startNetworkListener, stopNetworkListener, addNetworkListener, removeAllNetworkListeners, isNetworkListening, getNetworkListenerCount, } from "./utils/networkListener";
|
|
9
|
+
export { networkEventStore } from "./utils/networkEventStore";
|
|
10
|
+
export { formatBytes, formatDuration, formatHttpStatus, } from "./utils/formatting";
|
|
11
|
+
export type { NetworkEvent, NetworkStats, NetworkFilter, NetworkEventStatus, NetworkInsight, } from "./types";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/network/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACL,WAAW,EACX,cAAc,EACd,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network monitoring types for React Native dev tools
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Canonical shape for network activity captured by the dev tools interceptor.
|
|
6
|
+
*/
|
|
7
|
+
export interface NetworkEvent {
|
|
8
|
+
id: string;
|
|
9
|
+
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | string;
|
|
10
|
+
url: string;
|
|
11
|
+
status?: number;
|
|
12
|
+
statusText?: string;
|
|
13
|
+
requestHeaders: Record<string, string>;
|
|
14
|
+
responseHeaders: Record<string, string>;
|
|
15
|
+
requestData?: unknown;
|
|
16
|
+
responseData?: unknown;
|
|
17
|
+
responseSize?: number;
|
|
18
|
+
requestSize?: number;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
duration?: number;
|
|
21
|
+
error?: string;
|
|
22
|
+
host?: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
query?: string;
|
|
25
|
+
responseType?: string;
|
|
26
|
+
cached?: boolean;
|
|
27
|
+
requestClient?: "fetch" | "axios" | "graphql" | "grpc-web";
|
|
28
|
+
/**
|
|
29
|
+
* GraphQL operation name extracted from request data.
|
|
30
|
+
*
|
|
31
|
+
* For GraphQL requests, this contains the operation name (e.g., "GetUser", "CreatePost")
|
|
32
|
+
* extracted from either the operationName field or parsed from the query string.
|
|
33
|
+
* This enables searching and filtering GraphQL operations by name rather than just URL.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // For a GraphQL query like: query GetUser { user { id name } }
|
|
37
|
+
* // operationName will be: "GetUser"
|
|
38
|
+
*/
|
|
39
|
+
operationName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* GraphQL variables object for the operation.
|
|
42
|
+
*
|
|
43
|
+
* Contains the input parameters passed to the GraphQL query/mutation.
|
|
44
|
+
* Used to differentiate between multiple requests with the same operation name.
|
|
45
|
+
* Displayed with arrow notation matching React Query pattern: "GetPokemon › Sandshrew"
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // For query GetPokemon($id: String!) with variables { id: "Sandshrew" }
|
|
49
|
+
* // graphqlVariables will be: { id: "Sandshrew" }
|
|
50
|
+
* // Display: "GetPokemon › Sandshrew"
|
|
51
|
+
*/
|
|
52
|
+
graphqlVariables?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Aggregated counts derived from the currently loaded set of network events.
|
|
56
|
+
*/
|
|
57
|
+
export interface NetworkStats {
|
|
58
|
+
totalRequests: number;
|
|
59
|
+
successfulRequests: number;
|
|
60
|
+
failedRequests: number;
|
|
61
|
+
pendingRequests: number;
|
|
62
|
+
totalDataSent: number;
|
|
63
|
+
totalDataReceived: number;
|
|
64
|
+
averageDuration: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Criteria used when filtering network events in the UI.
|
|
68
|
+
*/
|
|
69
|
+
export interface NetworkFilter {
|
|
70
|
+
method?: string[];
|
|
71
|
+
status?: "success" | "error" | "pending" | "all";
|
|
72
|
+
contentType?: string[];
|
|
73
|
+
searchText?: string;
|
|
74
|
+
host?: string;
|
|
75
|
+
}
|
|
76
|
+
/** Human readable status classifications derived from request/response metadata. */
|
|
77
|
+
export type NetworkEventStatus = "pending" | "success" | "error" | "timeout";
|
|
78
|
+
/**
|
|
79
|
+
* Insight surfaces highlight notable traffic patterns or issues for the current session.
|
|
80
|
+
*/
|
|
81
|
+
export interface NetworkInsight {
|
|
82
|
+
type: "performance" | "error" | "security" | "optimization";
|
|
83
|
+
severity: "low" | "medium" | "high";
|
|
84
|
+
message: string;
|
|
85
|
+
details?: string;
|
|
86
|
+
eventId: string;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/network/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EACF,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,SAAS,GACT,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;IAC3D;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,oFAAoF;AACpF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IAC5D,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract GraphQL operation name from request data
|
|
3
|
+
*
|
|
4
|
+
* This utility extracts the operation name from GraphQL requests to enable
|
|
5
|
+
* searching and filtering by operation name rather than just URL paths.
|
|
6
|
+
*
|
|
7
|
+
* For GraphQL, all requests typically go to the same endpoint (e.g., /graphql),
|
|
8
|
+
* making URL-based search ineffective. This function extracts the actual
|
|
9
|
+
* operation name (e.g., "GetUser", "CreatePost") from the request payload.
|
|
10
|
+
*
|
|
11
|
+
* Extraction Methods (tried in order):
|
|
12
|
+
* 1. Direct operationName field in request data
|
|
13
|
+
* 2. Parse from query string using regex pattern
|
|
14
|
+
*
|
|
15
|
+
* @param requestData - The request data object (typically GraphQL query payload)
|
|
16
|
+
* @returns Operation name string or null if not found
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Method 1: Explicit operationName field
|
|
20
|
+
* const data1 = {
|
|
21
|
+
* operationName: "GetUser",
|
|
22
|
+
* query: "query GetUser { user { id name } }"
|
|
23
|
+
* };
|
|
24
|
+
* extractOperationName(data1); // Returns "GetUser"
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Method 2: Parse from query string
|
|
28
|
+
* const data2 = {
|
|
29
|
+
* query: "mutation CreatePost { createPost(title: \"Hello\") { id } }"
|
|
30
|
+
* };
|
|
31
|
+
* extractOperationName(data2); // Returns "CreatePost"
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // No operation name (anonymous query)
|
|
35
|
+
* const data3 = {
|
|
36
|
+
* query: "{ user { id name } }"
|
|
37
|
+
* };
|
|
38
|
+
* extractOperationName(data3); // Returns null
|
|
39
|
+
*/
|
|
40
|
+
export declare function extractOperationName(requestData: unknown): string | null;
|
|
41
|
+
//# sourceMappingURL=extractOperationName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractOperationName.d.ts","sourceRoot":"","sources":["../../../../src/network/utils/extractOperationName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAmCxE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format GraphQL variables for display using arrow notation
|
|
3
|
+
*
|
|
4
|
+
* Mimics React Query key display format to provide visual consistency:
|
|
5
|
+
* - React Query: ["pokemon", "Sandshrew"] → "pokemon › Sandshrew"
|
|
6
|
+
* - GraphQL: GetPokemon(id: "Sandshrew") → "GetPokemon › Sandshrew"
|
|
7
|
+
*
|
|
8
|
+
* Extracts only the values from variables (not keys) and formats them
|
|
9
|
+
* for clean, compact display in the network request list.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Extract variable values from GraphQL variables object
|
|
13
|
+
*
|
|
14
|
+
* Returns an array of formatted values for display with arrow notation.
|
|
15
|
+
*
|
|
16
|
+
* @param variables - GraphQL variables object
|
|
17
|
+
* @param maxValues - Maximum number of values to show (default: 3)
|
|
18
|
+
* @returns Array of formatted variable values
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* formatGraphQLVariables({ id: "pikachu" })
|
|
22
|
+
* // Returns: ["pikachu"]
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* formatGraphQLVariables({ userId: 123, includeProfile: true })
|
|
26
|
+
* // Returns: ["123", "true"]
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* formatGraphQLVariables({ filter: { status: "active" }, limit: 10 })
|
|
30
|
+
* // Returns: ["active", "10"]
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatGraphQLVariables(variables: Record<string, unknown> | undefined, maxValues?: number): string[] | null;
|
|
33
|
+
/**
|
|
34
|
+
* Combine operation name with variables using arrow notation
|
|
35
|
+
*
|
|
36
|
+
* Matches React Query display pattern: "pokemon › Sandshrew"
|
|
37
|
+
* This provides visual consistency across all dev tools.
|
|
38
|
+
*
|
|
39
|
+
* @param operationName - GraphQL operation name (e.g., "GetPokemon")
|
|
40
|
+
* @param variables - GraphQL variables object
|
|
41
|
+
* @returns Formatted string with arrow notation
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* formatGraphQLDisplay("GetPokemon", { id: "Sandshrew" })
|
|
45
|
+
* // Returns: "GetPokemon › Sandshrew"
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* formatGraphQLDisplay("GetUser", { userId: 123, includeProfile: true })
|
|
49
|
+
* // Returns: "GetUser › 123 › true"
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* formatGraphQLDisplay("GetPosts", { status: "published", limit: 10, offset: 0 })
|
|
53
|
+
* // Returns: "GetPosts › published › 10 › 0" (first 3 values by default)
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* formatGraphQLDisplay("GetCurrentUser", {})
|
|
57
|
+
* // Returns: "GetCurrentUser" (no variables)
|
|
58
|
+
*/
|
|
59
|
+
export declare function formatGraphQLDisplay(operationName: string, variables?: Record<string, unknown>): string;
|
|
60
|
+
/**
|
|
61
|
+
* Search GraphQL variables for a given text
|
|
62
|
+
*
|
|
63
|
+
* Recursively searches through all variable values to find matches.
|
|
64
|
+
* Used for filtering GraphQL requests by variable content.
|
|
65
|
+
*
|
|
66
|
+
* @param variables - GraphQL variables object
|
|
67
|
+
* @param searchText - Text to search for (already lowercased)
|
|
68
|
+
* @returns true if search text found in any variable value
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* searchGraphQLVariables({ id: "pikachu" }, "pika")
|
|
72
|
+
* // Returns: true
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* searchGraphQLVariables({ userId: 123, name: "John" }, "123")
|
|
76
|
+
* // Returns: true
|
|
77
|
+
*/
|
|
78
|
+
export declare function searchGraphQLVariables(variables: Record<string, unknown> | undefined, searchText: string): boolean;
|
|
79
|
+
//# sourceMappingURL=formatGraphQLVariables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatGraphQLVariables.d.ts","sourceRoot":"","sources":["../../../../src/network/utils/formatGraphQLVariables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA8DH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC9C,SAAS,GAAE,MAAU,GACpB,MAAM,EAAE,GAAG,IAAI,CAqBjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM,CAUR;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC9C,UAAU,EAAE,MAAM,GACjB,OAAO,CAaT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../src/network/utils/formatting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,cAAc,GACf,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network event store for managing captured network requests
|
|
3
|
+
* Works with the Reactotron-style network listener
|
|
4
|
+
*/
|
|
5
|
+
import type { NetworkEvent } from "../types";
|
|
6
|
+
import type { NetworkingEvent } from "./networkListener";
|
|
7
|
+
declare class NetworkEventStore {
|
|
8
|
+
private events;
|
|
9
|
+
private pendingRequests;
|
|
10
|
+
private listeners;
|
|
11
|
+
private maxEvents;
|
|
12
|
+
private recentRequests;
|
|
13
|
+
/**
|
|
14
|
+
* Process a network listener event
|
|
15
|
+
*/
|
|
16
|
+
processNetworkEvent(event: NetworkingEvent): void;
|
|
17
|
+
/**
|
|
18
|
+
* Extract host from URL
|
|
19
|
+
*/
|
|
20
|
+
private extractHost;
|
|
21
|
+
/**
|
|
22
|
+
* Extract path from URL
|
|
23
|
+
*/
|
|
24
|
+
private extractPath;
|
|
25
|
+
/**
|
|
26
|
+
* Get size of data
|
|
27
|
+
*/
|
|
28
|
+
private getDataSize;
|
|
29
|
+
/**
|
|
30
|
+
* Get all events
|
|
31
|
+
*/
|
|
32
|
+
getEvents(): NetworkEvent[];
|
|
33
|
+
/**
|
|
34
|
+
* Get event by ID
|
|
35
|
+
*/
|
|
36
|
+
getEventById(id: string): NetworkEvent | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Clear all events
|
|
39
|
+
*/
|
|
40
|
+
clearEvents(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe to event changes
|
|
43
|
+
*/
|
|
44
|
+
subscribe(listener: (events: NetworkEvent[]) => void): () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Notify all listeners of changes
|
|
47
|
+
*/
|
|
48
|
+
private notifyListeners;
|
|
49
|
+
/**
|
|
50
|
+
* Set maximum number of events to store
|
|
51
|
+
*/
|
|
52
|
+
setMaxEvents(max: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* Get statistics about network events
|
|
55
|
+
*/
|
|
56
|
+
getStats(): {
|
|
57
|
+
totalRequests: number;
|
|
58
|
+
successfulRequests: number;
|
|
59
|
+
failedRequests: number;
|
|
60
|
+
pendingRequests: number;
|
|
61
|
+
totalDataSent: number;
|
|
62
|
+
totalDataReceived: number;
|
|
63
|
+
averageDuration: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Filter events by criteria
|
|
67
|
+
*/
|
|
68
|
+
filterEvents(filter: {
|
|
69
|
+
method?: string;
|
|
70
|
+
status?: "success" | "error" | "pending";
|
|
71
|
+
searchText?: string;
|
|
72
|
+
host?: string;
|
|
73
|
+
}): NetworkEvent[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Singleton store that aggregates captured network traffic. Components and hooks consume this
|
|
77
|
+
* store to render histories, derive stats, and subscribe to real-time updates.
|
|
78
|
+
*/
|
|
79
|
+
export declare const networkEventStore: NetworkEventStore;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=networkEventStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkEventStore.d.ts","sourceRoot":"","sources":["../../../../src/network/utils/networkEventStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,cAAM,iBAAiB;IACrB,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,eAAe,CAAwC;IAC/D,OAAO,CAAC,SAAS,CAAoD;IACrE,OAAO,CAAC,SAAS,CAAO;IACxB,OAAO,CAAC,cAAc,CAAkC;IAExD;;OAEG;IACH,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IA0GjD;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACH,SAAS,IAAI,YAAY,EAAE;IAI3B;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIlD;;OAEG;IACH,WAAW,IAAI,IAAI;IAOnB;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,IAAI,GAAG,MAAM,IAAI;IAOjE;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQ/B;;OAEG;IACH,QAAQ;;;;;;;;;IAuCR;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;QACzC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,YAAY,EAAE;CAyCnB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|