Types
The Node SDK exports a minimal set of TypeScript interfaces and helper types that describe its configuration, responses, and errors.
These types are lightweight and designed for direct integration in your backend routes or custom service layers.
OrgaAIConfig
Configuration object accepted by the OrgaAI class constructor.
export interface OrgaAIConfig {
apiKey: string;
userEmail: string; // currently required (will be deprecated soon)
baseUrl?: string; // defaults to "https://api.orga-ai.com"
timeout?: number; // request timeout in ms (default 10000)
debug?: boolean; // enable console debugging
}| Field | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | ✅ | — | Your long‑lived Orga API key (must remain server‑side). |
userEmail | string | ✅ (for now) | — | Associated email identifier; used for audit logging. |
baseUrl | string | ❌ | https://api.orga-ai.com | Override the API endpoint (mainly for testing). |
timeout | number | ❌ | 10000 | Time limit for each HTTP request, in milliseconds. |
debug | boolean | ❌ | false | Prints detailed logs for each SDK operation. |
SessionConfig
Represents the object returned by OrgaAI.getSessionConfig().
export interface SessionConfig {
ephemeralToken: string;
iceServers: IceServer[];
}| Field | Type | Description |
|---|---|---|
ephemeralToken | string | Temporary credential used by clients to authenticate WebRTC sessions. |
iceServers | IceServer[] | Array of STUN/TURN servers used for WebRTC connectivity. |
IceServer
Describes a single WebRTC ICE (STUN/TURN) server configuration.
export interface IceServer {
urls: string | string[];
username?: string;
credential?: string;
}| Field | Type | Description |
|---|---|---|
urls | string | string[] | STUN/TURN server address(es). |
username | string | Optional TURN username for authenticated servers. |
credential | string | Optional credential associated with TURN access. |
📘 Note: The ICE servers follow the RTCIceServer spec for WebRTC compatibility.
These values are directly consumed by client SDKs during peer connection setup.
OrgaAIErrorType
Union type describing the categories of errors thrown by the SDK.
export type OrgaAIErrorType =
| "authentication_error"
| "server_error"
| "timeout_error"
| "configuration_error"
| "network_error";| Value | Description |
|---|---|
"authentication_error" | Invalid or missing API key / userEmail. |
"server_error" | Internal Orga Cloud error (5xx). |
"timeout_error" | Request exceeded configured timeout. |
"configuration_error" | Invalid or missing SDK configuration field. |
"network_error" | No internet connection or blocked HTTPS request. |
Example usage:
import type { OrgaAIErrorType, SessionConfig } from "@orga-ai/node";
function handleError(type: OrgaAIErrorType) {
if (type === "authentication_error") {
console.error("Invalid API key!");
}
}Example Full Type Flow
import type {
OrgaAIConfig,
SessionConfig,
IceServer,
} from "@orga-ai/node";
const config: OrgaAIConfig = {
apiKey: "sk_orga_ai_*****",
userEmail: "you@example.com",
timeout: 15000,
debug: true,
};
const session: SessionConfig = {
ephemeralToken: "eyJhbGciOi...",
iceServers: [
{ urls: "stun:stun1.l.google.com:19302" },
{
urls: ["turn:turn.orga-ai.com:3478"],
username: "6b4c...",
credential: "a1b2...",
},
],
};Re‑exported Types (for convenience)
@orga-ai/node re‑exports these base types from internal modules:
| Type | Description |
|---|---|
OrgaAIConfig | Constructor configuration for OrgaAI. |
SessionConfig | Combined response object with token and ICE servers. |
IceServer | STUN/TURN server descriptor. |
OrgaAIErrorType | Enumerated error categories. |
Next Steps
- Classes → Learn how to use
OrgaAIin your backend routes. - Errors → Understand error classes and handling patterns.
- Troubleshooting → Troubleshooting guide.
Last updated on