@vellumai/credential-executor 0.10.10 → 0.10.11-dev.202607212222.fe33210
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.
|
@@ -3,6 +3,7 @@ import { describe, expect, test } from "bun:test";
|
|
|
3
3
|
import {
|
|
4
4
|
normalizeHttpPublicBaseUrl,
|
|
5
5
|
normalizePublicBaseUrl,
|
|
6
|
+
velayHostForPlatformHost,
|
|
6
7
|
} from "../ingress.js";
|
|
7
8
|
import {
|
|
8
9
|
buildTwilioMediaStreamUrl,
|
|
@@ -11,6 +12,31 @@ import {
|
|
|
11
12
|
resolveTwilioPublicBaseUrl,
|
|
12
13
|
} from "../twilio-ingress.js";
|
|
13
14
|
|
|
15
|
+
describe("velayHostForPlatformHost", () => {
|
|
16
|
+
test("maps the prod platform host to prod velay", () => {
|
|
17
|
+
expect(velayHostForPlatformHost("platform.vellum.ai")).toBe(
|
|
18
|
+
"velay.vellum.ai",
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("maps env-prefixed platform hosts to their env velay", () => {
|
|
23
|
+
expect(velayHostForPlatformHost("staging-platform.vellum.ai")).toBe(
|
|
24
|
+
"velay-staging.vellum.ai",
|
|
25
|
+
);
|
|
26
|
+
expect(velayHostForPlatformHost("dev-platform.vellum.ai")).toBe(
|
|
27
|
+
"velay-dev.vellum.ai",
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("returns null for hosts outside the deployment convention", () => {
|
|
32
|
+
expect(velayHostForPlatformHost("localhost")).toBeNull();
|
|
33
|
+
expect(velayHostForPlatformHost("platform.example.com")).toBeNull();
|
|
34
|
+
expect(
|
|
35
|
+
velayHostForPlatformHost("staging-platform.vellum.ai.evil.com"),
|
|
36
|
+
).toBeNull();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
14
40
|
describe("normalizePublicBaseUrl", () => {
|
|
15
41
|
test("trims whitespace and trailing slashes", () => {
|
|
16
42
|
expect(normalizePublicBaseUrl(" https://example.test/path/// ")).toBe(
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map a Vellum platform host onto its environment's velay host, following the
|
|
3
|
+
* deployment naming convention (`platform.vellum.ai` → `velay.vellum.ai`,
|
|
4
|
+
* `{env}-platform.vellum.ai` → `velay-{env}.vellum.ai`). Returns null for
|
|
5
|
+
* hosts outside that convention (localhost, custom domains). Shared by the
|
|
6
|
+
* gateway speech relay and the web live-voice client so the two ends of the
|
|
7
|
+
* managed-speech transport can't drift.
|
|
8
|
+
*/
|
|
9
|
+
export function velayHostForPlatformHost(host: string): string | null {
|
|
10
|
+
if (host === "platform.vellum.ai") {
|
|
11
|
+
return "velay.vellum.ai";
|
|
12
|
+
}
|
|
13
|
+
const match = /^([a-z0-9-]+)-platform\.vellum\.ai$/.exec(host);
|
|
14
|
+
return match ? `velay-${match[1]}.vellum.ai` : null;
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
export function normalizePublicBaseUrl(value: unknown): string | undefined {
|
|
2
18
|
if (typeof value !== "string") return undefined;
|
|
3
19
|
const normalized = value.trim().replace(/\/+$/, "");
|