@buoy-gg/network 7.0.27 → 7.0.28

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.
@@ -206,6 +206,8 @@ function NetworkEventItemCompact({
206
206
  contentStyle: [styles.container, {
207
207
  borderLeftColor: statusColor
208
208
  }],
209
+ testID: `buoy-network-row-${event.id}`,
210
+ accessibilityLabel: `${event.method} ${event.path || event.url}`,
209
211
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
210
212
  style: styles.topRightContainer,
211
213
  children: [pinned ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Pin, {
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.httpStatusText = httpStatusText;
7
+ exports.xhrCompletionKind = xhrCompletionKind;
8
+ /**
9
+ * Classify a completed XHR/fetch HTTP status.
10
+ *
11
+ * A 4xx/5xx is a *response*, not a transport error. RN's XHR leaves
12
+ * `statusText` empty, which used to become `event.error = "HTTP 500: "` and
13
+ * then MCP `ERR HTTP 500: no error`.
14
+ */
15
+
16
+ const STATUS_TEXT = {
17
+ 400: "Bad Request",
18
+ 401: "Unauthorized",
19
+ 403: "Forbidden",
20
+ 404: "Not Found",
21
+ 408: "Request Timeout",
22
+ 429: "Too Many Requests",
23
+ 500: "Internal Server Error",
24
+ 502: "Bad Gateway",
25
+ 503: "Service Unavailable",
26
+ 504: "Gateway Timeout"
27
+ };
28
+
29
+ /** status 0 (or missing) means the request never got an HTTP response. */
30
+ function xhrCompletionKind(status) {
31
+ return typeof status === "number" && status > 0 ? "response" : "error";
32
+ }
33
+ function httpStatusText(status, statusText) {
34
+ const trimmed = (statusText ?? "").trim();
35
+ if (trimmed) return trimmed;
36
+ return STATUS_TEXT[status] ?? "";
37
+ }
@@ -8,6 +8,7 @@ var _engine = require("../overrides/engine");
8
8
  var _applyToXhr = require("../overrides/applyToXhr");
9
9
  var _applyToFetch = require("../overrides/applyToFetch");
10
10
  var _types = require("../overrides/types");
11
+ var _httpCompletion = require("./httpCompletion");
11
12
  /**
12
13
  * Network listener using Reactotron-style event pattern
13
14
  * Simple and reliable network interception for React Native
@@ -385,8 +386,10 @@ class NetworkListener {
385
386
  // Ignore header parsing errors
386
387
  }
387
388
 
388
- // Emit response or error based on status
389
- if (xhr.status >= 200 && xhr.status < 400) {
389
+ // Emit response or error based on status. A 4xx/5xx is a completed HTTP
390
+ // response, not a transport error — RN XHR leaves statusText empty, which
391
+ // used to become `event.error = "HTTP 500: "` and MCP `ERR HTTP 500: no error`.
392
+ if ((0, _httpCompletion.xhrCompletionKind)(xhr.status) === "response") {
390
393
  this.emit({
391
394
  type: "response",
392
395
  timestamp: new Date(),
@@ -403,7 +406,7 @@ class NetworkListener {
403
406
  },
404
407
  response: {
405
408
  status: xhr.status,
406
- statusText: xhr.statusText,
409
+ statusText: (0, _httpCompletion.httpStatusText)(xhr.status, xhr.statusText),
407
410
  headers: responseHeaders,
408
411
  body,
409
412
  size: responseSize
@@ -432,7 +435,7 @@ class NetworkListener {
432
435
  size: responseSize
433
436
  },
434
437
  error: {
435
- message: `HTTP ${xhr.status}: ${xhr.statusText}`
438
+ message: "Network Error"
436
439
  },
437
440
  override
438
441
  });
@@ -203,6 +203,8 @@ function NetworkEventItemCompact({
203
203
  contentStyle: [styles.container, {
204
204
  borderLeftColor: statusColor
205
205
  }],
206
+ testID: `buoy-network-row-${event.id}`,
207
+ accessibilityLabel: `${event.method} ${event.path || event.url}`,
206
208
  children: [/*#__PURE__*/_jsxs(View, {
207
209
  style: styles.topRightContainer,
208
210
  children: [pinned ? /*#__PURE__*/_jsx(Pin, {
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Classify a completed XHR/fetch HTTP status.
5
+ *
6
+ * A 4xx/5xx is a *response*, not a transport error. RN's XHR leaves
7
+ * `statusText` empty, which used to become `event.error = "HTTP 500: "` and
8
+ * then MCP `ERR HTTP 500: no error`.
9
+ */
10
+
11
+ const STATUS_TEXT = {
12
+ 400: "Bad Request",
13
+ 401: "Unauthorized",
14
+ 403: "Forbidden",
15
+ 404: "Not Found",
16
+ 408: "Request Timeout",
17
+ 429: "Too Many Requests",
18
+ 500: "Internal Server Error",
19
+ 502: "Bad Gateway",
20
+ 503: "Service Unavailable",
21
+ 504: "Gateway Timeout"
22
+ };
23
+
24
+ /** status 0 (or missing) means the request never got an HTTP response. */
25
+ export function xhrCompletionKind(status) {
26
+ return typeof status === "number" && status > 0 ? "response" : "error";
27
+ }
28
+ export function httpStatusText(status, statusText) {
29
+ const trimmed = (statusText ?? "").trim();
30
+ if (trimmed) return trimmed;
31
+ return STATUS_TEXT[status] ?? "";
32
+ }
@@ -9,6 +9,7 @@ import { overrideForRequest } from "../overrides/engine";
9
9
  import { runOverride } from "../overrides/applyToXhr";
10
10
  import { canSynthesizeResponse, sleep, synthesizeFetchError, synthesizeResponse } from "../overrides/applyToFetch";
11
11
  import { markForOutcome } from "../overrides/types";
12
+ import { httpStatusText, xhrCompletionKind } from "./httpCompletion";
12
13
 
13
14
  /**
14
15
  * True only while `originalFetch` is being CALLED (not awaited).
@@ -382,8 +383,10 @@ class NetworkListener {
382
383
  // Ignore header parsing errors
383
384
  }
384
385
 
385
- // Emit response or error based on status
386
- if (xhr.status >= 200 && xhr.status < 400) {
386
+ // Emit response or error based on status. A 4xx/5xx is a completed HTTP
387
+ // response, not a transport error — RN XHR leaves statusText empty, which
388
+ // used to become `event.error = "HTTP 500: "` and MCP `ERR HTTP 500: no error`.
389
+ if (xhrCompletionKind(xhr.status) === "response") {
387
390
  this.emit({
388
391
  type: "response",
389
392
  timestamp: new Date(),
@@ -400,7 +403,7 @@ class NetworkListener {
400
403
  },
401
404
  response: {
402
405
  status: xhr.status,
403
- statusText: xhr.statusText,
406
+ statusText: httpStatusText(xhr.status, xhr.statusText),
404
407
  headers: responseHeaders,
405
408
  body,
406
409
  size: responseSize
@@ -429,7 +432,7 @@ class NetworkListener {
429
432
  size: responseSize
430
433
  },
431
434
  error: {
432
- message: `HTTP ${xhr.status}: ${xhr.statusText}`
435
+ message: "Network Error"
433
436
  },
434
437
  override
435
438
  });
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkEventItemCompact.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkEventItemCompact.tsx"],"names":[],"mappings":"AAiBA,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;IACvC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAoJD,eAAO,MAAM,uBAAuB,oEA4HnC,CAAC"}
1
+ {"version":3,"file":"NetworkEventItemCompact.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkEventItemCompact.tsx"],"names":[],"mappings":"AAiBA,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;IACvC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAoJD,eAAO,MAAM,uBAAuB,oEA8HnC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Classify a completed XHR/fetch HTTP status.
3
+ *
4
+ * A 4xx/5xx is a *response*, not a transport error. RN's XHR leaves
5
+ * `statusText` empty, which used to become `event.error = "HTTP 500: "` and
6
+ * then MCP `ERR HTTP 500: no error`.
7
+ */
8
+ /** status 0 (or missing) means the request never got an HTTP response. */
9
+ export declare function xhrCompletionKind(status: number | undefined): "response" | "error";
10
+ export declare function httpStatusText(status: number, statusText?: string | null): string;
11
+ //# sourceMappingURL=httpCompletion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpCompletion.d.ts","sourceRoot":"","sources":["../../../../src/network/utils/httpCompletion.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAElF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAIjF"}
@@ -1 +1 @@
1
- {"version":3,"file":"networkListener.d.ts","sourceRoot":"","sources":["../../../../src/network/utils/networkListener.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAS/C,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AA8B9E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IACvC,SAAS,EAAE,IAAI,CAAC;IAChB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,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,uBAAuB;IAa7C,kBAAkB;IAKlB,IAAI,QAAQ,YAEX;IAGD,IAAI,aAAa,WAEhB;CACF;AAsBD;;;;GAIG;AACH,eAAO,MAAM,eAAe,uBAAqB,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,YAA8C,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,mBAAmB,YAA6C,CAAC;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,uBAAuB,eACxB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,yBAAyB,YACK,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,eAAsC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,cAA2C,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,eACK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/network",
3
- "version": "7.0.27",
3
+ "version": "7.0.28",
4
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",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@buoy-gg/shared-ui": "^7.0.27"
29
+ "@buoy-gg/shared-ui": "^7.0.28"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "*",