@builder.io/ai-utils 0.66.0 → 0.66.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/package.json +1 -1
- package/src/connectivity/browser.d.ts +1 -1
- package/src/connectivity/browser.js +1 -1
- package/src/connectivity/environment.js +1 -2
- package/src/connectivity/node.d.ts +1 -1
- package/src/connectivity/node.js +1 -1
- package/src/connectivity/targets.d.ts +13 -1
- package/src/connectivity/targets.js +33 -4
- package/src/connectivity/targets.spec.js +34 -1
- package/src/connectivity/types.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { Source, TestId, Test, RunChecksInput, ProgressEvent, CheckResult, CheckReport, ConnectivityErrorCode, CheckType, Recommendation, LikelyCause, ConnectivityStatus, AnalysisResult, AnalyzeConnectivityInput, } from "./types.js";
|
|
2
2
|
export { runChecks } from "./run-checks.browser.js";
|
|
3
3
|
export { mapNodeErrorToConnectivityCode, mapHttpStatusToErrorCode, mapFetchErrorToConnectivityCode, connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, SELF_SIGNED_CERT_ERRORS, CERT_EXPIRED_ERRORS, CERT_NOT_YET_VALID_ERRORS, CERT_INVALID_ERRORS, CERT_HOSTNAME_MISMATCH_ERRORS, SSL_PROTOCOL_ERRORS, SSL_HANDSHAKE_ERRORS, NETWORK_UNREACHABLE_ERRORS, TIMEOUT_ERRORS, PROXY_ERRORS, DNS_ERRORS, } from "./error-codes.js";
|
|
4
|
-
export { BUILDER_TARGETS, DEFAULT_PORTS, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
4
|
+
export { BUILDER_TARGETS, DEFAULT_PORTS, DEFAULT_LOCAL_BUILDER_TESTS, BUILDER_TEST_DISPLAY_NAMES, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
5
5
|
export { isBrowser, isNode, getCheckTypeForTestId, isCheckAvailable, getUnavailabilityReason, } from "./environment.js";
|
|
6
6
|
export { httpCheck } from "./checks/http-check.js";
|
|
7
7
|
export type { HttpCheckOptions } from "./checks/http-check.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { runChecks } from "./run-checks.browser.js";
|
|
2
2
|
export { mapNodeErrorToConnectivityCode, mapHttpStatusToErrorCode, mapFetchErrorToConnectivityCode, connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, SELF_SIGNED_CERT_ERRORS, CERT_EXPIRED_ERRORS, CERT_NOT_YET_VALID_ERRORS, CERT_INVALID_ERRORS, CERT_HOSTNAME_MISMATCH_ERRORS, SSL_PROTOCOL_ERRORS, SSL_HANDSHAKE_ERRORS, NETWORK_UNREACHABLE_ERRORS, TIMEOUT_ERRORS, PROXY_ERRORS, DNS_ERRORS, } from "./error-codes.js";
|
|
3
|
-
export { BUILDER_TARGETS, DEFAULT_PORTS, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
3
|
+
export { BUILDER_TARGETS, DEFAULT_PORTS, DEFAULT_LOCAL_BUILDER_TESTS, BUILDER_TEST_DISPLAY_NAMES, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
4
4
|
export { isBrowser, isNode, getCheckTypeForTestId, isCheckAvailable, getUnavailabilityReason, } from "./environment.js";
|
|
5
5
|
export { httpCheck } from "./checks/http-check.js";
|
|
@@ -7,8 +7,7 @@ export function isNode() {
|
|
|
7
7
|
process.versions.node != null);
|
|
8
8
|
}
|
|
9
9
|
export function getCheckTypeForTestId(testId) {
|
|
10
|
-
if (testId === "
|
|
11
|
-
testId === "health.builderio.dev:ws") {
|
|
10
|
+
if (testId === "builderio.xyz:ws" || testId === "builderio.dev:ws") {
|
|
12
11
|
return "websocket";
|
|
13
12
|
}
|
|
14
13
|
if (testId.startsWith("git-host:")) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { Source, TestId, Test, RunChecksInput, ProgressEvent, CheckResult, CheckReport, ConnectivityErrorCode, CheckType, Recommendation, LikelyCause, ConnectivityStatus, AnalysisResult, AnalyzeConnectivityInput, ConnectivityFetchFn, } from "./types.js";
|
|
2
2
|
export { runChecks } from "./run-checks.js";
|
|
3
3
|
export { mapNodeErrorToConnectivityCode, mapHttpStatusToErrorCode, mapFetchErrorToConnectivityCode, connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, SELF_SIGNED_CERT_ERRORS, CERT_EXPIRED_ERRORS, CERT_NOT_YET_VALID_ERRORS, CERT_INVALID_ERRORS, CERT_HOSTNAME_MISMATCH_ERRORS, SSL_PROTOCOL_ERRORS, SSL_HANDSHAKE_ERRORS, NETWORK_UNREACHABLE_ERRORS, TIMEOUT_ERRORS, PROXY_ERRORS, DNS_ERRORS, } from "./error-codes.js";
|
|
4
|
-
export { BUILDER_TARGETS, DEFAULT_PORTS, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
4
|
+
export { BUILDER_TARGETS, DEFAULT_PORTS, DEFAULT_LOCAL_BUILDER_TESTS, BUILDER_TEST_DISPLAY_NAMES, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
5
5
|
export { isBrowser, isNode, getCheckTypeForTestId, isCheckAvailable, getUnavailabilityReason, } from "./environment.js";
|
|
6
6
|
export { httpCheck } from "./checks/http-check.js";
|
|
7
7
|
export type { HttpCheckOptions } from "./checks/http-check.js";
|
package/src/connectivity/node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { runChecks } from "./run-checks.js";
|
|
2
2
|
export { mapNodeErrorToConnectivityCode, mapHttpStatusToErrorCode, mapFetchErrorToConnectivityCode, connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, SELF_SIGNED_CERT_ERRORS, CERT_EXPIRED_ERRORS, CERT_NOT_YET_VALID_ERRORS, CERT_INVALID_ERRORS, CERT_HOSTNAME_MISMATCH_ERRORS, SSL_PROTOCOL_ERRORS, SSL_HANDSHAKE_ERRORS, NETWORK_UNREACHABLE_ERRORS, TIMEOUT_ERRORS, PROXY_ERRORS, DNS_ERRORS, } from "./error-codes.js";
|
|
3
|
-
export { BUILDER_TARGETS, DEFAULT_PORTS, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
3
|
+
export { BUILDER_TARGETS, DEFAULT_PORTS, DEFAULT_LOCAL_BUILDER_TESTS, BUILDER_TEST_DISPLAY_NAMES, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
4
4
|
export { isBrowser, isNode, getCheckTypeForTestId, isCheckAvailable, getUnavailabilityReason, } from "./environment.js";
|
|
5
5
|
export { httpCheck } from "./checks/http-check.js";
|
|
6
6
|
export { dnsCheck } from "./checks/dns-check.js";
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import type { TestId } from "./types.js";
|
|
1
|
+
import type { Test, TestId } from "./types.js";
|
|
2
2
|
export declare const BUILDER_TARGETS: Record<string, string>;
|
|
3
|
+
/**
|
|
4
|
+
* Canonical ordered list of Builder-service connectivity tests, matching what
|
|
5
|
+
* the Builder app's ConnectivityService runs locally. Includes the four kube
|
|
6
|
+
* domain health probes (HTTP + WebSocket) for both *.builderio.xyz and
|
|
7
|
+
* *.builderio.dev.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_LOCAL_BUILDER_TESTS: Test[];
|
|
10
|
+
/**
|
|
11
|
+
* Human-readable display names for Builder service testIds. Used by CLI and
|
|
12
|
+
* UI surfaces to show friendly labels instead of raw testId strings.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BUILDER_TEST_DISPLAY_NAMES: Partial<Record<TestId, string>>;
|
|
3
15
|
export declare const DEFAULT_PORTS: Record<string, number>;
|
|
4
16
|
export declare function resolveTarget(testId: TestId, gitHost?: string): string;
|
|
5
17
|
export declare function extractHostname(target: string): string;
|
|
@@ -3,12 +3,41 @@ export const BUILDER_TARGETS = {
|
|
|
3
3
|
"builder.codes": "https://test.projects.builder.codes/proxy-health",
|
|
4
4
|
"api.builder.io": "https://api.builder.io/codegen/health",
|
|
5
5
|
"cdn.builder.io": "https://cdn.builder.io/api/v1/image/assets/TEMP/75a212ab82b6175c9862b125e0e23db8d369a58a?width=100",
|
|
6
|
-
|
|
7
|
-
"health.
|
|
8
|
-
|
|
9
|
-
"
|
|
6
|
+
// Health subdomains — dedicated endpoints for VPN/firewall diagnostics.
|
|
7
|
+
// The testId omits the "health." prefix for readability; the URL still
|
|
8
|
+
// targets health.builderio.* so wildcard allowlists are verified.
|
|
9
|
+
"builderio.xyz": "https://health.builderio.xyz/health",
|
|
10
|
+
"builderio.xyz:ws": "wss://health.builderio.xyz/ws",
|
|
11
|
+
"builderio.dev": "https://health.builderio.dev/health",
|
|
12
|
+
"builderio.dev:ws": "wss://health.builderio.dev/ws",
|
|
10
13
|
"fly.dev": "https://fly.dev",
|
|
11
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Canonical ordered list of Builder-service connectivity tests, matching what
|
|
17
|
+
* the Builder app's ConnectivityService runs locally. Includes the four kube
|
|
18
|
+
* domain health probes (HTTP + WebSocket) for both *.builderio.xyz and
|
|
19
|
+
* *.builderio.dev.
|
|
20
|
+
*/
|
|
21
|
+
export const DEFAULT_LOCAL_BUILDER_TESTS = [
|
|
22
|
+
{ source: "local", testId: "builder.io" },
|
|
23
|
+
{ source: "local", testId: "builder.codes" },
|
|
24
|
+
{ source: "local", testId: "api.builder.io" },
|
|
25
|
+
{ source: "local", testId: "cdn.builder.io" },
|
|
26
|
+
{ source: "local", testId: "builderio.xyz" },
|
|
27
|
+
{ source: "local", testId: "builderio.xyz:ws" },
|
|
28
|
+
{ source: "local", testId: "builderio.dev" },
|
|
29
|
+
{ source: "local", testId: "builderio.dev:ws" },
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* Human-readable display names for Builder service testIds. Used by CLI and
|
|
33
|
+
* UI surfaces to show friendly labels instead of raw testId strings.
|
|
34
|
+
*/
|
|
35
|
+
export const BUILDER_TEST_DISPLAY_NAMES = {
|
|
36
|
+
"builderio.xyz": "*.builderio.xyz",
|
|
37
|
+
"builderio.xyz:ws": "*.builderio.xyz (WebSocket)",
|
|
38
|
+
"builderio.dev": "*.builderio.dev",
|
|
39
|
+
"builderio.dev:ws": "*.builderio.dev (WebSocket)",
|
|
40
|
+
};
|
|
12
41
|
export const DEFAULT_PORTS = {
|
|
13
42
|
http: 443,
|
|
14
43
|
https: 443,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { extractPort, extractExplicitPort } from "./targets";
|
|
2
|
+
import { extractPort, extractExplicitPort, BUILDER_TARGETS, DEFAULT_LOCAL_BUILDER_TESTS, BUILDER_TEST_DISPLAY_NAMES, } from "./targets";
|
|
3
3
|
describe("extractPort", () => {
|
|
4
4
|
it("returns explicit port from URL", () => {
|
|
5
5
|
expect(extractPort("https://git.amazon.com:2222", 443)).toBe(2222);
|
|
@@ -43,3 +43,36 @@ describe("extractExplicitPort", () => {
|
|
|
43
43
|
expect(extractExplicitPort("not-a-url", 22)).toBe(22);
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
+
describe("DEFAULT_LOCAL_BUILDER_TESTS", () => {
|
|
47
|
+
const KUBE_IDS = [
|
|
48
|
+
"builderio.xyz",
|
|
49
|
+
"builderio.xyz:ws",
|
|
50
|
+
"builderio.dev",
|
|
51
|
+
"builderio.dev:ws",
|
|
52
|
+
];
|
|
53
|
+
it("includes all four kube domain test IDs", () => {
|
|
54
|
+
const ids = DEFAULT_LOCAL_BUILDER_TESTS.map((t) => t.testId);
|
|
55
|
+
for (const id of KUBE_IDS) {
|
|
56
|
+
expect(ids).toContain(id);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
it("all tests have source=local", () => {
|
|
60
|
+
for (const t of DEFAULT_LOCAL_BUILDER_TESTS) {
|
|
61
|
+
expect(t.source).toBe("local");
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
it("kube testIds resolve to health subdomain URLs (testId omits health. prefix; URL does not)", () => {
|
|
65
|
+
expect(BUILDER_TARGETS["builderio.xyz"]).toBe("https://health.builderio.xyz/health");
|
|
66
|
+
expect(BUILDER_TARGETS["builderio.xyz:ws"]).toBe("wss://health.builderio.xyz/ws");
|
|
67
|
+
expect(BUILDER_TARGETS["builderio.dev"]).toBe("https://health.builderio.dev/health");
|
|
68
|
+
expect(BUILDER_TARGETS["builderio.dev:ws"]).toBe("wss://health.builderio.dev/ws");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe("BUILDER_TEST_DISPLAY_NAMES", () => {
|
|
72
|
+
it("maps all four kube testIds to user-friendly labels", () => {
|
|
73
|
+
expect(BUILDER_TEST_DISPLAY_NAMES["builderio.xyz"]).toBe("*.builderio.xyz");
|
|
74
|
+
expect(BUILDER_TEST_DISPLAY_NAMES["builderio.xyz:ws"]).toBe("*.builderio.xyz (WebSocket)");
|
|
75
|
+
expect(BUILDER_TEST_DISPLAY_NAMES["builderio.dev"]).toBe("*.builderio.dev");
|
|
76
|
+
expect(BUILDER_TEST_DISPLAY_NAMES["builderio.dev:ws"]).toBe("*.builderio.dev (WebSocket)");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type Source = "local" | "cloud" | "static-ip";
|
|
2
|
-
export type TestId = "builder.io" | "builder.codes" | "api.builder.io" | "cdn.builder.io" | "
|
|
2
|
+
export type TestId = "builder.io" | "builder.codes" | "api.builder.io" | "cdn.builder.io" | "builderio.xyz" | "builderio.xyz:ws" | "builderio.dev" | "builderio.dev:ws" | "fly.dev" | "git-host:http" | "git-host:dns" | "git-host:tcp" | "git-host:tls" | "git-host:ssh";
|
|
3
3
|
export interface Test {
|
|
4
4
|
source: Source;
|
|
5
5
|
testId: TestId;
|