Calls helpers
Helpers exported by @morevoice/sdk from src/lib/calls.ts.
Exported from @morevoice/sdk (source: packages/sdk-ts/src/lib/calls.ts).
CallLike
Section titled “CallLike”The call fields the helper reads. The facade returns the full generated Call type.
interface CallLike { id: string; status?: string | null; ended_at?: string | null; summary?: unknown; [field: string]: unknown;}FINAL_CALL_STATUSES
Section titled “FINAL_CALL_STATUSES”Statuses after which a call never changes again (besides its post-call analysis).
const FINAL_CALL_STATUSES: readonly string[];isCallEnded()
Section titled “isCallEnded()”True when the call is over: a final status, or an ended_at.
function isCallEnded(call: CallLike): boolean;WaitUntilEndedOptions
Section titled “WaitUntilEndedOptions”interface WaitUntilEndedOptions { /** Give up after this long (default 10 minutes), with a WaitTimeoutError. */ timeoutMs?: number; /** Stops waiting; the promise rejects with the signal's reason. */ signal?: AbortSignal; /** After the call ends, wait up to this long for its summary (`call.analyzed`). Default 0: resolve at once. */ waitForAnalysisMs?: number; /** First polling interval (default 1000 ms); it grows ×1.5 per poll up to `maxPollIntervalMs`. */ pollIntervalMs?: number; /** Longest polling interval (default 10 000 ms). */ maxPollIntervalMs?: number; /** Called with every state the helper sees (each poll, and the final one). */ onUpdate?: (call: CallLike) => void;}CallStreamEventLike
Section titled “CallStreamEventLike”A stream event the helper reacts to (the C9 envelope; only type is read).
interface CallStreamEventLike { type?: string;}WaitDeps
Section titled “WaitDeps”What waitUntilEnded needs from the client.
interface WaitDeps<C extends CallLike> { /** GET /v1/calls/{id}. */ retrieve(callId: string, options: { signal: AbortSignal }): Promise<C>; /** The call's event stream, when the API offers one; it should end after `call.ended`. */ stream?: (callId: string, options: { signal: AbortSignal; types: string[] }) => AsyncIterable<CallStreamEventLike>;}DEFAULT_WAIT_TIMEOUT_MS
Section titled “DEFAULT_WAIT_TIMEOUT_MS”const DEFAULT_WAIT_TIMEOUT_MS = 600_000;waitUntilEnded()
Section titled “waitUntilEnded()”Wait for a call to end. See the file header.
function waitUntilEnded<C extends CallLike>(deps: WaitDeps<C>, callId: string, options: WaitUntilEndedOptions = {}): Promise<C>;