@anam-ai/js-sdk 4.2.0-oz-alpha.5 → 4.2.0-oz-alpha.6
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/dist/main/AnamClient.js +5 -5
- package/dist/main/AnamClient.js.map +1 -1
- package/dist/main/lib/validateApiGatewayConfig.d.ts +8 -0
- package/dist/main/lib/validateApiGatewayConfig.d.ts.map +1 -0
- package/dist/main/lib/validateApiGatewayConfig.js +35 -0
- package/dist/main/lib/validateApiGatewayConfig.js.map +1 -0
- package/dist/main/modules/CoreApiRestClient.d.ts +3 -3
- package/dist/main/modules/CoreApiRestClient.d.ts.map +1 -1
- package/dist/main/modules/CoreApiRestClient.js +10 -10
- package/dist/main/modules/CoreApiRestClient.js.map +1 -1
- package/dist/main/modules/EngineApiRestClient.d.ts +3 -3
- package/dist/main/modules/EngineApiRestClient.d.ts.map +1 -1
- package/dist/main/modules/EngineApiRestClient.js +7 -11
- package/dist/main/modules/EngineApiRestClient.js.map +1 -1
- package/dist/main/modules/SignallingClient.d.ts +3 -3
- package/dist/main/modules/SignallingClient.d.ts.map +1 -1
- package/dist/main/modules/SignallingClient.js +15 -12
- package/dist/main/modules/SignallingClient.js.map +1 -1
- package/dist/main/modules/StreamingClient.d.ts +1 -1
- package/dist/main/modules/StreamingClient.d.ts.map +1 -1
- package/dist/main/modules/StreamingClient.js +3 -3
- package/dist/main/modules/StreamingClient.js.map +1 -1
- package/dist/main/types/ApiGatewayConfig.d.ts +45 -0
- package/dist/main/types/ApiGatewayConfig.d.ts.map +1 -0
- package/dist/main/types/{ProxyConfig.js → ApiGatewayConfig.js} +1 -1
- package/dist/main/types/ApiGatewayConfig.js.map +1 -0
- package/dist/main/types/coreApi/ApiOptions.d.ts +2 -2
- package/dist/main/types/coreApi/ApiOptions.d.ts.map +1 -1
- package/dist/main/types/index.d.ts +1 -1
- package/dist/main/types/index.d.ts.map +1 -1
- package/dist/main/types/streaming/StreamingClientOptions.d.ts +2 -2
- package/dist/main/types/streaming/StreamingClientOptions.d.ts.map +1 -1
- package/dist/module/AnamClient.js +5 -5
- package/dist/module/AnamClient.js.map +1 -1
- package/dist/module/lib/validateApiGatewayConfig.d.ts +8 -0
- package/dist/module/lib/validateApiGatewayConfig.d.ts.map +1 -0
- package/dist/module/lib/validateApiGatewayConfig.js +31 -0
- package/dist/module/lib/validateApiGatewayConfig.js.map +1 -0
- package/dist/module/modules/CoreApiRestClient.d.ts +3 -3
- package/dist/module/modules/CoreApiRestClient.d.ts.map +1 -1
- package/dist/module/modules/CoreApiRestClient.js +10 -10
- package/dist/module/modules/CoreApiRestClient.js.map +1 -1
- package/dist/module/modules/EngineApiRestClient.d.ts +3 -3
- package/dist/module/modules/EngineApiRestClient.d.ts.map +1 -1
- package/dist/module/modules/EngineApiRestClient.js +7 -11
- package/dist/module/modules/EngineApiRestClient.js.map +1 -1
- package/dist/module/modules/SignallingClient.d.ts +3 -3
- package/dist/module/modules/SignallingClient.d.ts.map +1 -1
- package/dist/module/modules/SignallingClient.js +15 -12
- package/dist/module/modules/SignallingClient.js.map +1 -1
- package/dist/module/modules/StreamingClient.d.ts +1 -1
- package/dist/module/modules/StreamingClient.d.ts.map +1 -1
- package/dist/module/modules/StreamingClient.js +3 -3
- package/dist/module/modules/StreamingClient.js.map +1 -1
- package/dist/module/types/ApiGatewayConfig.d.ts +45 -0
- package/dist/module/types/ApiGatewayConfig.d.ts.map +1 -0
- package/dist/module/types/ApiGatewayConfig.js +2 -0
- package/dist/module/types/ApiGatewayConfig.js.map +1 -0
- package/dist/module/types/coreApi/ApiOptions.d.ts +2 -2
- package/dist/module/types/coreApi/ApiOptions.d.ts.map +1 -1
- package/dist/module/types/index.d.ts +1 -1
- package/dist/module/types/index.d.ts.map +1 -1
- package/dist/module/types/streaming/StreamingClientOptions.d.ts +2 -2
- package/dist/module/types/streaming/StreamingClientOptions.d.ts.map +1 -1
- package/dist/umd/anam.js +1 -1
- package/package.json +1 -1
- package/dist/main/lib/validateProxyConfig.d.ts +0 -8
- package/dist/main/lib/validateProxyConfig.d.ts.map +0 -1
- package/dist/main/lib/validateProxyConfig.js +0 -54
- package/dist/main/lib/validateProxyConfig.js.map +0 -1
- package/dist/main/types/ProxyConfig.d.ts +0 -57
- package/dist/main/types/ProxyConfig.d.ts.map +0 -1
- package/dist/main/types/ProxyConfig.js.map +0 -1
- package/dist/module/lib/validateProxyConfig.d.ts +0 -8
- package/dist/module/lib/validateProxyConfig.d.ts.map +0 -1
- package/dist/module/lib/validateProxyConfig.js +0 -50
- package/dist/module/lib/validateProxyConfig.js.map +0 -1
- package/dist/module/types/ProxyConfig.d.ts +0 -57
- package/dist/module/types/ProxyConfig.d.ts.map +0 -1
- package/dist/module/types/ProxyConfig.js +0 -2
- package/dist/module/types/ProxyConfig.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateProxyConfig.d.ts","sourceRoot":"","sources":["../../../src/lib/validateProxyConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CA4CpB"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates proxy configuration
|
|
3
|
-
* @param proxyConfig - The proxy configuration to validate
|
|
4
|
-
* @returns Error message if invalid, undefined if valid
|
|
5
|
-
*/
|
|
6
|
-
export function validateProxyConfig(proxyConfig) {
|
|
7
|
-
if (!proxyConfig || !proxyConfig.enabled) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
// Validate WebSocket proxy URL protocol
|
|
11
|
-
if (proxyConfig.websocket) {
|
|
12
|
-
try {
|
|
13
|
-
const wsUrl = new URL(proxyConfig.websocket);
|
|
14
|
-
if (wsUrl.protocol !== 'ws:' && wsUrl.protocol !== 'wss:') {
|
|
15
|
-
return `Invalid WebSocket proxy URL: "${proxyConfig.websocket}". WebSocket proxy must use ws:// or wss:// protocol.`;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
return `Invalid WebSocket proxy URL: "${proxyConfig.websocket}". Must be a valid URL.`;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
// Validate API proxy URL (can be relative or absolute)
|
|
23
|
-
if (proxyConfig.api) {
|
|
24
|
-
try {
|
|
25
|
-
// Try to parse as absolute URL
|
|
26
|
-
new URL(proxyConfig.api);
|
|
27
|
-
}
|
|
28
|
-
catch (_a) {
|
|
29
|
-
// Not an absolute URL, must be a relative path starting with /
|
|
30
|
-
if (!proxyConfig.api.startsWith('/')) {
|
|
31
|
-
return `Invalid API proxy URL: "${proxyConfig.api}". Must be an absolute URL (https://...) or a path starting with /.`;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// Validate Engine proxy URL (can be relative or absolute)
|
|
36
|
-
if (proxyConfig.engine) {
|
|
37
|
-
try {
|
|
38
|
-
// Try to parse as absolute URL
|
|
39
|
-
new URL(proxyConfig.engine);
|
|
40
|
-
}
|
|
41
|
-
catch (_b) {
|
|
42
|
-
// Not an absolute URL, must be a relative path starting with /
|
|
43
|
-
if (!proxyConfig.engine.startsWith('/')) {
|
|
44
|
-
return `Invalid Engine proxy URL: "${proxyConfig.engine}". Must be an absolute URL (https://...) or a path starting with /.`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=validateProxyConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateProxyConfig.js","sourceRoot":"","sources":["../../../src/lib/validateProxyConfig.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAAoC;IAEpC,IAAI,CAAC,WAAW,IA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ACnB,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for proxying SDK requests through a custom proxy server.
|
|
3
|
-
*
|
|
4
|
-
* When enabled, the SDK will route HTTP REST calls and WebSocket signalling
|
|
5
|
-
* through the specified proxy base URLs while maintaining the same endpoint paths.
|
|
6
|
-
* WebRTC peer connections remain direct.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* - Proxy is opt-in and disabled by default
|
|
10
|
-
* - Proxy base URLs replace Anam's base URLs, but paths remain the same
|
|
11
|
-
* - Original target info passed via standard forwarding headers (X-Forwarded-Host, X-Forwarded-Proto, X-Original-URI)
|
|
12
|
-
* - Also includes X-Anam-Target-Url for convenience
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const client = createClient(sessionToken, {
|
|
17
|
-
* proxy: {
|
|
18
|
-
* enabled: true,
|
|
19
|
-
* api: 'https://my-proxy.com', // Proxies to api.anam.ai
|
|
20
|
-
* engine: 'https://my-proxy.com', // Proxies to engine servers
|
|
21
|
-
* websocket: 'wss://my-proxy.com' // Proxies WebSocket connections
|
|
22
|
-
* }
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export interface ProxyConfig {
|
|
27
|
-
/**
|
|
28
|
-
* Enable or disable proxy routing
|
|
29
|
-
*/
|
|
30
|
-
enabled: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Proxy base URL for Anam API requests (session creation, auth)
|
|
33
|
-
* Replaces https://api.anam.ai base URL
|
|
34
|
-
*
|
|
35
|
-
* @example 'https://my-proxy.com' or '/api/proxy' for same-origin
|
|
36
|
-
*/
|
|
37
|
-
api?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Proxy base URL for Engine API requests (talk commands, etc.)
|
|
40
|
-
* Replaces the engine server base URL.
|
|
41
|
-
* The original engine base url is dynamic for each session.
|
|
42
|
-
* The forwarding headers can be used to construct the full original target URL.
|
|
43
|
-
*
|
|
44
|
-
* @example 'https://my-proxy.com' or '/api/proxy' for same-origin
|
|
45
|
-
*/
|
|
46
|
-
engine?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Proxy base URL for WebSocket signalling connections
|
|
49
|
-
* Replaces the engine WebSocket base URL.
|
|
50
|
-
* The original WebSocket base url is dynamic for each session.
|
|
51
|
-
* The websocket query parameters can be used to construct the full original target URL.
|
|
52
|
-
*
|
|
53
|
-
* @example 'wss://my-proxy.com' or 'ws://localhost:3000/api/proxy'
|
|
54
|
-
*/
|
|
55
|
-
websocket?: string;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=ProxyConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyConfig.d.ts","sourceRoot":"","sources":["../../../src/types/ProxyConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyConfig.js","sourceRoot":"","sources":["../../../src/types/ProxyConfig.ts"],"names":[],"mappings":""}
|