@builder.io/ai-utils 0.38.2 → 0.38.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.38.2",
3
+ "version": "0.38.3",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,4 +1,4 @@
1
- import { mapHttpStatusToErrorCode, mapFetchErrorToConnectivityCode, } from "../error-codes.js";
1
+ import { mapFetchErrorToConnectivityCode } from "../error-codes.js";
2
2
  import { isBrowser } from "../environment.js";
3
3
  const DEFAULT_TIMEOUT_MS = 30000;
4
4
  const LATENCY_THRESHOLD_MS = 5000;
@@ -25,15 +25,15 @@ export async function httpCheck(options) {
25
25
  : await fetchFn(target, { method, signal, redirect });
26
26
  clearTimeout(timeoutId);
27
27
  const durationMs = Date.now() - startTime;
28
- const errorCode = mapHttpStatusToErrorCode(response.status);
29
28
  const hasHighLatency = durationMs > LATENCY_THRESHOLD_MS;
30
- if (errorCode) {
29
+ const isServerError = response.status >= 500;
30
+ if (isServerError) {
31
31
  return {
32
32
  source,
33
33
  testId,
34
34
  target,
35
35
  passed: false,
36
- errorCode,
36
+ errorCode: "http_server_error",
37
37
  durationMs,
38
38
  metadata: {
39
39
  statusCode: response.status,
@@ -41,6 +41,8 @@ export async function httpCheck(options) {
41
41
  },
42
42
  };
43
43
  }
44
+ // Any non-5xx HTTP response means we successfully connected to the server.
45
+ // We don't care about 4xx etc. — only that the server is reachable and responding.
44
46
  return {
45
47
  source,
46
48
  testId,