@treeseed/sdk 0.12.30 → 0.12.32
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.
|
@@ -8,6 +8,15 @@ function sleep(ms) {
|
|
|
8
8
|
function normalizedBaseUrl(value2) {
|
|
9
9
|
return value2.trim().replace(/\/+$/u, "");
|
|
10
10
|
}
|
|
11
|
+
function isLoopbackBaseUrl(value2) {
|
|
12
|
+
if (!value2) return false;
|
|
13
|
+
try {
|
|
14
|
+
const url = new URL(value2);
|
|
15
|
+
return ["localhost", "127.0.0.1", "0.0.0.0", "::1", "[::1]"].includes(url.hostname);
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
11
20
|
function value(name, values, env) {
|
|
12
21
|
const candidate = env[name] ?? values[name];
|
|
13
22
|
return typeof candidate === "string" && candidate.trim() ? candidate.trim() : null;
|
|
@@ -27,7 +36,8 @@ function manifestApiBaseUrl(tenantRoot, environment) {
|
|
|
27
36
|
const config = loadTreeseedDeployConfigFromPath(candidate);
|
|
28
37
|
const connectionUrl = config.connections?.api?.environments?.[environment]?.baseUrl;
|
|
29
38
|
const serviceUrl = config.services?.api?.environments?.[environment]?.baseUrl;
|
|
30
|
-
const
|
|
39
|
+
const apiDomain = config.surfaces?.api?.environments?.[environment]?.domain;
|
|
40
|
+
const baseUrl = connectionUrl ?? serviceUrl ?? (typeof apiDomain === "string" && apiDomain.trim() ? `https://${apiDomain.trim()}` : null);
|
|
31
41
|
if (typeof baseUrl === "string" && baseUrl.trim()) {
|
|
32
42
|
return baseUrl.trim();
|
|
33
43
|
}
|
|
@@ -108,8 +118,11 @@ async function runTreeseedOperationsRunnerSmoke(options) {
|
|
|
108
118
|
values = {};
|
|
109
119
|
}
|
|
110
120
|
const baseUrl = normalizedBaseUrl(
|
|
111
|
-
options.baseUrl ?? manifestApiBaseUrl(options.tenantRoot, options.environment) ?? value("TREESEED_API_BASE_URL", values, env) ?? value("TREESEED_CENTRAL_MARKET_API_BASE_URL", values, env) ?? defaultBaseUrl(options.environment)
|
|
121
|
+
options.baseUrl ?? manifestApiBaseUrl(options.tenantRoot, options.environment) ?? (options.environment === "local" ? value("TREESEED_API_BASE_URL", values, env) : null) ?? (options.environment === "local" ? value("TREESEED_CENTRAL_MARKET_API_BASE_URL", values, env) : null) ?? defaultBaseUrl(options.environment)
|
|
112
122
|
);
|
|
123
|
+
if (options.environment !== "local" && isLoopbackBaseUrl(baseUrl)) {
|
|
124
|
+
return failure(baseUrl, options.environment, [`Operations runner smoke for ${options.environment} must target a live hosted API URL, not ${baseUrl}.`], []);
|
|
125
|
+
}
|
|
113
126
|
const serviceId = options.serviceId ?? value("TREESEED_ACCEPTANCE_SERVICE_ID", values, env) ?? value("TREESEED_WEB_SERVICE_ID", values, env) ?? value("TREESEED_API_WEB_SERVICE_ID", values, env) ?? "web";
|
|
114
127
|
const localServiceSecret = options.environment === "local" ? envValue("TREESEED_ACCEPTANCE_SERVICE_SECRET", env) ?? envValue("TREESEED_WEB_SERVICE_SECRET", env) ?? envValue("TREESEED_API_WEB_SERVICE_SECRET", env) ?? localManagedDevServiceSecret(options.environment) : null;
|
|
115
128
|
const serviceSecret = options.serviceSecret ?? localServiceSecret ?? value("TREESEED_ACCEPTANCE_SERVICE_SECRET", values, env) ?? value("TREESEED_WEB_SERVICE_SECRET", values, env) ?? value("TREESEED_API_WEB_SERVICE_SECRET", values, env);
|