/// import * as Api from './api'; import { Readable, Writable } from 'stream'; import { ArrayCombine } from './utility-types'; import { Logger, LoggerOptions } from 'pino'; import { WsState } from './ws'; import { getMacros } from './macros'; declare const customEventCodes: readonly ["on_audio_data", "on_image_data"]; declare const customEventNames: readonly ["onAudioData", "onImageData"]; declare type StreamGetterOptions = { pcm: boolean | { resample?: boolean | SamplingRate; stabilize?: boolean | number; }; }; declare type StreamGetter = (options?: StreamGetterOptions) => Readable; interface CustomEventAudioData { event: Api.EventStreamStart; opusInfo: OpusInfo; getStream: StreamGetter; } interface CustomEventImageData { event: Api.EventImage; } declare type CustomEventList = [CustomEventAudioData, CustomEventImageData]; declare type EventCodes = [...typeof Api.eventCodes, ...typeof customEventCodes]; declare type EventCode = EventCodes[number]; declare type EventNames = [...typeof Api.eventNames, ...typeof customEventNames]; declare type EventName = EventNames[number]; declare type EventList = [...Api.EventList, ...CustomEventList]; declare type EventMap = ArrayCombine; declare type EventNameToCode = ArrayCombine; declare type EventCallback = (data: EventMap[T]) => void; declare type EventCallbacks = { [P in EventCode]?: EventCallback

; }; declare type Event = (cb: EventCallback) => void; declare type Events = { [P in EventName]: Event; }; declare const customCommandCodes: readonly ["send_audio_data", "send_image_data"]; declare const customCommandNames: readonly ["sendAudioData", "sendImageData"]; interface CustomCommandSendAudioDataRequest { streamId: number; frameSize: number; } interface CustomCommandSendAudioDataResponse { stream: Writable; } interface CustomCommandSendImageDataRequest { imageId: number; fullSizeData: Buffer; thumbnailData: Buffer; } interface CustomCommandSendImageDataResponse { (): Promise; } declare type CustomCommandList = [ [ CustomCommandSendAudioDataRequest, CustomCommandSendAudioDataResponse ], [ CustomCommandSendImageDataRequest, CustomCommandSendImageDataResponse ] ]; declare type CommandCodes = [...typeof Api.commandCodes, ...typeof customCommandCodes]; declare type CommandCode = CommandCodes[number]; declare type CommandNames = [...typeof Api.commandNames, ...typeof customCommandNames]; declare type CommandName = CommandNames[number]; declare type CommandList = [...Api.CommandList, ...CustomCommandList]; declare type CommandMap = ArrayCombine; declare type CommandNameToCode = ArrayCombine; declare type Command = (request: Omit, timeout?: number) => Promise; declare type Commands = { [P in CommandName]: Command; }; declare function isCommandSendAudioData(arg: any, command: CommandCode): arg is CustomCommandSendAudioDataRequest; declare function isCommandSendImageData(arg: any, command: CommandCode): arg is CustomCommandSendImageDataRequest; declare type AwaitFilterCallback = (data: EventMap[T]) => boolean; declare type Await = (filter: AwaitFilterCallback | boolean, timeout: number) => Promise; declare type Awaits = { [P in EventName]: Await

; }; declare type Zello = { name: string; ctl: Readonly; events: Readonly; commands: Readonly; awaits: Readonly; macros: Readonly>; logger: Logger; }; declare type ZelloMacro = Omit; declare type Script = ((props: Readonly) => Generator, TReturn, any>) | ((props: Readonly) => TReturn); declare function isScript(arg: any): arg is Script; declare function isScriptGenerator(arg: any): arg is Generator; declare type Macro = (props: Omit) => T; declare type Options = { logger: LoggerOptions | Logger; name: string; }; declare function isOptions(arg: any): arg is Options; interface Ctl { close: () => Promise; status: () => WsState; run: (script: Script) => Promise; } declare type ServerAddress = string; declare function isServerAddress(arg: any): arg is ServerAddress; declare function isPromise(arg: any): arg is Promise; declare type OpusInfo = { channels: number; inputSampleRate: number; framesPerPacket: number; frameSize: number; }; declare const samplingRates: readonly [8000, 12000, 16000, 24000, 48000]; declare type SamplingRate = typeof samplingRates[number]; declare const frameSizes: readonly [2.5, 5, 10, 20, 40, 60]; declare type FrameSize = typeof frameSizes[number]; declare type Channels = 1 | 2; declare type FFmpegArgs = string[]; declare type DeferredPromise = { resolve: (arg: T) => void; reject?: any; }; export { Events, Commands, Awaits, CommandCode, CommandMap, isCommandSendAudioData, isCommandSendImageData, EventCallbacks, EventNameToCode, EventName, EventCode, Event, Await, EventMap, Command, Macro, Script, Options, Ctl, isServerAddress, isScript, isScriptGenerator, isOptions, isPromise, Zello, ZelloMacro, StreamGetter, OpusInfo, DeferredPromise, samplingRates, SamplingRate, FFmpegArgs, frameSizes, FrameSize, Channels, StreamGetterOptions, };