@buoy-gg/network 6.0.0 → 6.0.1
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 +29 -353
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,381 +1,57 @@
|
|
|
1
|
-
# @buoy/network
|
|
1
|
+
# @buoy-gg/network
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@buoy-gg/network) [](https://www.npmjs.com/package/@buoy-gg/network)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**See every HTTP request your React Native app makes — URL, headers, payloads, timing, and errors — live on the device, no Flipper or proxy required.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Part of [Buoy](https://github.com/Buoy-gg/buoy) — devtools that live inside your React Native app. Install it and it auto-appears in the floating menu from [`@buoy-gg/core`](https://www.npmjs.com/package/@buoy-gg/core).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- **Request/Response Inspection**: View detailed information about headers, payloads, and responses
|
|
11
|
-
- **Filtering**: Filter requests by status code, HTTP method, or URL pattern
|
|
12
|
-
- **Timing Information**: See request duration and timing details
|
|
13
|
-
- **Search**: Search through captured network events
|
|
14
|
-
- **Pause/Resume**: Control when to capture network events
|
|
15
|
-
- **Clear History**: Clear captured events when needed
|
|
16
|
-
- **Beautiful UI**: Modern, game-themed interface matching other React Buoy tools
|
|
9
|
+

|
|
17
10
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
This package is part of the React Buoy monorepo and is automatically available to other packages and the example app.
|
|
21
|
-
|
|
22
|
-
For external projects:
|
|
11
|
+
## Install
|
|
23
12
|
|
|
24
13
|
```bash
|
|
25
|
-
npm install @buoy/network
|
|
26
|
-
# or
|
|
27
|
-
pnpm add @buoy/network
|
|
28
|
-
# or
|
|
29
|
-
yarn add @buoy/network
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Quick Start
|
|
33
|
-
|
|
34
|
-
### Simplest Setup - Just 1 Line!
|
|
35
|
-
|
|
36
|
-
**Import the preset and add it to your tools array. Done!**
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
import { networkToolPreset } from '@buoy/network';
|
|
40
|
-
import { FloatingDevTools } from '@buoy/core';
|
|
41
|
-
|
|
42
|
-
const installedApps = [
|
|
43
|
-
networkToolPreset, // That's it! One line.
|
|
44
|
-
// ...your other tools
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
function App() {
|
|
48
|
-
return (
|
|
49
|
-
<FloatingDevTools
|
|
50
|
-
apps={installedApps}
|
|
51
|
-
environment="local"
|
|
52
|
-
userRole="admin"
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Done!** The preset automatically:
|
|
59
|
-
- ✅ Monitors all network requests
|
|
60
|
-
- ✅ Intercepts fetch and XMLHttpRequest
|
|
61
|
-
- ✅ Provides filtering and search
|
|
62
|
-
- ✅ No configuration required
|
|
63
|
-
|
|
64
|
-
### Custom Configuration
|
|
65
|
-
|
|
66
|
-
If you want to customize the appearance or behavior:
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
import { createNetworkTool } from '@buoy/network';
|
|
70
|
-
|
|
71
|
-
const myNetworkTool = createNetworkTool({
|
|
72
|
-
name: "REQUESTS",
|
|
73
|
-
colorPreset: "purple",
|
|
74
|
-
enableSharedModalDimensions: true,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const installedApps = [
|
|
78
|
-
myNetworkTool,
|
|
79
|
-
// ...other tools
|
|
80
|
-
];
|
|
14
|
+
npm install @buoy-gg/core @buoy-gg/network
|
|
81
15
|
```
|
|
82
16
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
If you're not using FloatingDevTools or want more control:
|
|
17
|
+
## Quick start
|
|
86
18
|
|
|
87
|
-
|
|
88
|
-
import { NetworkModal } from '@buoy/network';
|
|
19
|
+
Fully automatic. Render the floating menu once — the Network Monitor is auto-discovered as soon as this package is installed:
|
|
89
20
|
|
|
90
|
-
|
|
91
|
-
|
|
21
|
+
```tsx
|
|
22
|
+
import { FloatingDevTools } from "@buoy-gg/core";
|
|
92
23
|
|
|
24
|
+
export default function App() {
|
|
93
25
|
return (
|
|
94
26
|
<>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</Button>
|
|
98
|
-
|
|
99
|
-
<NetworkModal
|
|
100
|
-
visible={showNetwork}
|
|
101
|
-
onClose={() => setShowNetwork(false)}
|
|
102
|
-
/>
|
|
27
|
+
{/* your app */}
|
|
28
|
+
<FloatingDevTools />
|
|
103
29
|
</>
|
|
104
30
|
);
|
|
105
31
|
}
|
|
106
32
|
```
|
|
107
33
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
### Presets
|
|
111
|
-
|
|
112
|
-
#### `networkToolPreset`
|
|
113
|
-
|
|
114
|
-
Pre-configured network monitoring tool ready to use with FloatingDevTools.
|
|
115
|
-
|
|
116
|
-
**Example:**
|
|
117
|
-
```typescript
|
|
118
|
-
import { networkToolPreset } from '@buoy/network';
|
|
119
|
-
|
|
120
|
-
const installedApps = [networkToolPreset];
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
#### `createNetworkTool(options?)`
|
|
124
|
-
|
|
125
|
-
Create a custom network monitoring tool configuration.
|
|
126
|
-
|
|
127
|
-
**Options:**
|
|
128
|
-
```typescript
|
|
129
|
-
{
|
|
130
|
-
/** Tool name (default: "NET") */
|
|
131
|
-
name?: string;
|
|
132
|
-
/** Tool description */
|
|
133
|
-
description?: string;
|
|
134
|
-
/** Icon color preset (default: "cyan") */
|
|
135
|
-
colorPreset?: "orange" | "cyan" | "purple" | "pink" | "yellow" | "green";
|
|
136
|
-
/** Custom tool ID (default: "network") */
|
|
137
|
-
id?: string;
|
|
138
|
-
/** Enable shared modal dimensions */
|
|
139
|
-
enableSharedModalDimensions?: boolean;
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
**Example:**
|
|
144
|
-
```typescript
|
|
145
|
-
import { createNetworkTool } from '@buoy/network';
|
|
146
|
-
|
|
147
|
-
const myNetworkTool = createNetworkTool({
|
|
148
|
-
name: "API CALLS",
|
|
149
|
-
colorPreset: "green",
|
|
150
|
-
enableSharedModalDimensions: true,
|
|
151
|
-
});
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Components
|
|
155
|
-
|
|
156
|
-
#### `NetworkModal`
|
|
157
|
-
|
|
158
|
-
Main modal component for monitoring network requests.
|
|
159
|
-
|
|
160
|
-
**Props:**
|
|
161
|
-
```typescript
|
|
162
|
-
interface NetworkModalProps {
|
|
163
|
-
/** Whether the modal is visible */
|
|
164
|
-
visible: boolean;
|
|
165
|
-
/** Callback when modal is closed */
|
|
166
|
-
onClose: () => void;
|
|
167
|
-
/** Optional back button handler */
|
|
168
|
-
onBack?: () => void;
|
|
169
|
-
/** Whether to use shared modal dimensions */
|
|
170
|
-
enableSharedModalDimensions?: boolean;
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
**Example:**
|
|
175
|
-
```typescript
|
|
176
|
-
<NetworkModal
|
|
177
|
-
visible={isVisible}
|
|
178
|
-
onClose={handleClose}
|
|
179
|
-
enableSharedModalDimensions={true}
|
|
180
|
-
/>
|
|
181
|
-
```
|
|
34
|
+
Want a different label or color? Build the tool with `createNetworkTool({ name, colorPreset })` and pass it via `apps={[...]}`.
|
|
182
35
|
|
|
183
|
-
|
|
36
|
+
## What you get
|
|
184
37
|
|
|
185
|
-
|
|
38
|
+
- **Every request, zero config** — intercepts `fetch` and `XMLHttpRequest`, so fetch, axios, GraphQL clients, and gRPC-web all show up automatically.
|
|
39
|
+
- **GraphQL gets special treatment** — operation names are extracted from queries, mutations, and subscriptions and shown with variables in arrow notation: `GetUser › 123`. No more guessing which `/graphql` request is which.
|
|
40
|
+
- **Full request detail** — request/response headers, payloads, HTTP status, and duration for every call, with status-colored rows.
|
|
41
|
+
- **Filter and search** — narrow by status code, HTTP method, or URL pattern; search captured events; pause/resume capture; clear history.
|
|
42
|
+
- **Ignore the noise** — a shared ignored-domains/URL filter (`useIgnoredPatterns`) hides endpoints you never want to see, shared with the Events tool.
|
|
43
|
+
- **Hooks for custom UIs** — `useNetworkEvents`, `useNetworkEventList`, and `useNetworkBadgeCounts` expose the capture stream with narrow per-consumer subscriptions.
|
|
186
44
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
**Returns:**
|
|
190
|
-
```typescript
|
|
191
|
-
{
|
|
192
|
-
/** Array of captured network events */
|
|
193
|
-
events: NetworkEvent[];
|
|
194
|
-
/** Whether interception is enabled */
|
|
195
|
-
isEnabled: boolean;
|
|
196
|
-
/** Enable network interception */
|
|
197
|
-
enable: () => void;
|
|
198
|
-
/** Disable network interception */
|
|
199
|
-
disable: () => void;
|
|
200
|
-
/** Clear all captured events */
|
|
201
|
-
clear: () => void;
|
|
202
|
-
}
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**Example:**
|
|
206
|
-
```typescript
|
|
207
|
-
import { useNetworkEvents } from '@buoy/network';
|
|
208
|
-
|
|
209
|
-
function MyComponent() {
|
|
210
|
-
const { events, isEnabled, enable, disable, clear } = useNetworkEvents();
|
|
211
|
-
|
|
212
|
-
return (
|
|
213
|
-
<View>
|
|
214
|
-
<Text>Captured {events.length} requests</Text>
|
|
215
|
-
<Button onPress={isEnabled ? disable : enable}>
|
|
216
|
-
{isEnabled ? 'Pause' : 'Resume'}
|
|
217
|
-
</Button>
|
|
218
|
-
<Button onPress={clear}>Clear</Button>
|
|
219
|
-
</View>
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### Types
|
|
225
|
-
|
|
226
|
-
#### `NetworkEvent`
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
interface NetworkEvent {
|
|
230
|
-
/** Unique event ID */
|
|
231
|
-
id: string;
|
|
232
|
-
/** Request URL */
|
|
233
|
-
url: string;
|
|
234
|
-
/** HTTP method */
|
|
235
|
-
method: string;
|
|
236
|
-
/** HTTP status code */
|
|
237
|
-
status?: number;
|
|
238
|
-
/** Request headers */
|
|
239
|
-
requestHeaders?: Record<string, string>;
|
|
240
|
-
/** Response headers */
|
|
241
|
-
responseHeaders?: Record<string, string>;
|
|
242
|
-
/** Request body */
|
|
243
|
-
requestBody?: any;
|
|
244
|
-
/** Response body */
|
|
245
|
-
responseBody?: any;
|
|
246
|
-
/** Request start timestamp */
|
|
247
|
-
startTime: number;
|
|
248
|
-
/** Request end timestamp */
|
|
249
|
-
endTime?: number;
|
|
250
|
-
/** Request duration in ms */
|
|
251
|
-
duration?: number;
|
|
252
|
-
/** Error message if request failed */
|
|
253
|
-
error?: string;
|
|
254
|
-
}
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
## Use Cases
|
|
258
|
-
|
|
259
|
-
### API Debugging
|
|
260
|
-
|
|
261
|
-
Monitor all API calls to your backend:
|
|
262
|
-
|
|
263
|
-
```typescript
|
|
264
|
-
import { networkToolPreset } from '@buoy/network';
|
|
265
|
-
|
|
266
|
-
// Add to your dev tools
|
|
267
|
-
const installedApps = [networkToolPreset];
|
|
268
|
-
|
|
269
|
-
// Now you can:
|
|
270
|
-
// - See all API requests in real-time
|
|
271
|
-
// - Inspect request/response payloads
|
|
272
|
-
// - Check response times
|
|
273
|
-
// - Debug failed requests
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Performance Monitoring
|
|
277
|
-
|
|
278
|
-
Track slow network requests:
|
|
279
|
-
|
|
280
|
-
```typescript
|
|
281
|
-
import { useNetworkEvents } from '@buoy/network';
|
|
282
|
-
|
|
283
|
-
function PerformanceMonitor() {
|
|
284
|
-
const { events } = useNetworkEvents();
|
|
285
|
-
|
|
286
|
-
const slowRequests = events.filter(e => e.duration && e.duration > 1000);
|
|
287
|
-
|
|
288
|
-
return (
|
|
289
|
-
<View>
|
|
290
|
-
<Text>Slow Requests: {slowRequests.length}</Text>
|
|
291
|
-
{slowRequests.map(req => (
|
|
292
|
-
<Text key={req.id}>
|
|
293
|
-
{req.url} took {req.duration}ms
|
|
294
|
-
</Text>
|
|
295
|
-
))}
|
|
296
|
-
</View>
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### Request Filtering
|
|
302
|
-
|
|
303
|
-
Filter requests by specific criteria:
|
|
304
|
-
|
|
305
|
-
```typescript
|
|
306
|
-
// In the Network Modal UI:
|
|
307
|
-
// - Filter by status code (200, 404, 500, etc.)
|
|
308
|
-
// - Filter by HTTP method (GET, POST, PUT, DELETE)
|
|
309
|
-
// - Search by URL pattern
|
|
310
|
-
// - Filter by success/error state
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
## Features in Detail
|
|
314
|
-
|
|
315
|
-
### Network Interception
|
|
316
|
-
|
|
317
|
-
The package automatically intercepts:
|
|
318
|
-
- `fetch()` calls
|
|
319
|
-
- `XMLHttpRequest` calls
|
|
320
|
-
- All HTTP methods (GET, POST, PUT, DELETE, PATCH, etc.)
|
|
321
|
-
|
|
322
|
-
### Request Details
|
|
323
|
-
|
|
324
|
-
For each request, you can view:
|
|
325
|
-
- Full URL and query parameters
|
|
326
|
-
- HTTP method and status code
|
|
327
|
-
- Request and response headers
|
|
328
|
-
- Request and response bodies
|
|
329
|
-
- Timing information (duration, timestamps)
|
|
330
|
-
- Error details if the request failed
|
|
331
|
-
|
|
332
|
-
### Filtering & Search
|
|
333
|
-
|
|
334
|
-
- **By Status**: Filter by HTTP status codes
|
|
335
|
-
- **By Method**: Filter by HTTP method
|
|
336
|
-
- **By URL**: Search through request URLs
|
|
337
|
-
- **By State**: Filter successful, pending, or failed requests
|
|
338
|
-
|
|
339
|
-
### Performance Tracking
|
|
340
|
-
|
|
341
|
-
- View request duration
|
|
342
|
-
- Identify slow requests
|
|
343
|
-
- Monitor request timing
|
|
344
|
-
- Track request count
|
|
345
|
-
|
|
346
|
-
## Dependencies
|
|
347
|
-
|
|
348
|
-
- `@buoy/shared-ui` - Common UI components and utilities
|
|
349
|
-
- React and React Native (peer dependencies)
|
|
350
|
-
|
|
351
|
-
## Development
|
|
352
|
-
|
|
353
|
-
### Building
|
|
354
|
-
|
|
355
|
-
```bash
|
|
356
|
-
pnpm build
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
### Type Checking
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
pnpm typecheck
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
### Clean Build
|
|
366
|
-
|
|
367
|
-
```bash
|
|
368
|
-
pnpm clean
|
|
369
|
-
```
|
|
45
|
+
## Desktop & AI
|
|
370
46
|
|
|
371
|
-
|
|
47
|
+
The same live session streams to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) (free, macOS/Windows/Linux) and to Claude Code or Cursor via the [Buoy MCP server](https://buoy.gg/buoy/latest/docs/mcp).
|
|
372
48
|
|
|
373
|
-
|
|
49
|
+
## Free vs Pro
|
|
374
50
|
|
|
375
|
-
|
|
51
|
+
Every tool is free. [Pro](https://buoy.gg/pricing) unlocks production builds, the MCP server, and unlimited capture. Every weekend, Pro features unlock free for everyone.
|
|
376
52
|
|
|
377
|
-
|
|
53
|
+
---
|
|
378
54
|
|
|
379
|
-
|
|
55
|
+
📚 [Full docs](https://buoy.gg/buoy/latest/docs/tools/network) · [All Buoy tools](https://github.com/Buoy-gg/buoy)
|
|
380
56
|
|
|
381
|
-
|
|
57
|
+
Proprietary software. © Buoy LLC. [Terms](https://buoy.gg/terms)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/network",
|
|
3
|
-
"version": "6.0.
|
|
4
|
-
"description": "network
|
|
3
|
+
"version": "6.0.1",
|
|
4
|
+
"description": "In-app network inspector for React Native — requests, responses, timing & errors live, with GraphQL operation parsing. Part of Buoy devtools.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@buoy-gg/shared-ui": "6.0.
|
|
29
|
+
"@buoy-gg/shared-ui": "6.0.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "*",
|