@meyer/hyperdeck-emulator
Version:
Typescript Node.js library for emulating a Blackmagic Hyperdeck
281 lines • 8.46 kB
TypeScript
import { ArgKey, ArgsTypes } from './types';
interface Option<A extends Record<string, ArgKey> = Record<string, ArgKey>, R extends Record<string, ArgKey> = Record<string, ArgKey>> {
description: string;
arguments?: A;
returnValue: R;
}
declare type ParamMap = Record<string, Option>;
interface ParamInfo {
paramType: ArgKey;
/** The camelcase name we use everywhere */
paramName: string;
}
/** Internal container class that holds metadata about each HyperDeck event */
declare class HyperDeckAPI<P extends ParamMap = {}> {
readonly options: P;
constructor(options?: P);
addOption: <K extends string, A extends Record<string, "string" | "number" | "boolean" | "timecode" | "videoformat" | "stopmode" | "goto" | "videoinput" | "audioinput" | "fileformat" | "audiocodec" | "timecodeinput" | "recordtrigger" | "clips" | "slotstatus" | "transportstatus"> = {}, R extends Record<string, "string" | "number" | "boolean" | "timecode" | "videoformat" | "stopmode" | "goto" | "videoinput" | "audioinput" | "fileformat" | "audiocodec" | "timecodeinput" | "recordtrigger" | "clips" | "slotstatus" | "transportstatus"> = {}>(key: K | [K, ...string[]], option: Option<A, R>) => HyperDeckAPI<P & { [key in K]: Option<A, R>; }>;
/** Get a `Set` of param names keyed by function name */
getParamsByCommandName: () => { [K in keyof P]: Record<string, ParamInfo>; };
}
declare const api: HyperDeckAPI<{
help: Option<{}, {}>;
} & {
commands: Option<{}, {
commands: "string";
}>;
} & {
"device info": Option<{}, {
protocolVersion: "string";
model: "string";
slotCount: "string";
}>;
} & {
"disk list": Option<{
slotId: "number";
}, {
slotId: "number";
}>;
} & {
quit: Option<{}, {}>;
} & {
ping: Option<{}, {}>;
} & {
preview: Option<{
enable: "boolean";
}, {}>;
} & {
play: Option<{
speed: "number";
loop: "boolean";
singleClip: "boolean";
}, {}>;
} & {
playrange: Option<{}, {}>;
} & {
"playrange set": Option<{
clipId: "number";
in: "timecode";
out: "timecode";
timelineIn: "number";
timelineOut: "number";
}, {}>;
} & {
"playrange clear": Option<{}, {}>;
} & {
"play on startup": Option<{
enable: "boolean";
singleClip: "boolean";
}, {}>;
} & {
"play option": Option<{
stopMode: "stopmode";
}, {}>;
} & {
record: Option<{
name: "string";
}, {}>;
} & {
"record spill": Option<{
slotId: "number";
}, {}>;
} & {
stop: Option<{}, {}>;
} & {
"clips count": Option<{}, {
clipCount: "number";
}>;
} & {
"clips get": Option<{
clipId: "number";
count: "number";
version: "number";
}, {
clips: "clips";
}>;
} & {
"clips add": Option<{
name: "string";
clipId: "number";
in: "timecode";
out: "timecode";
}, {}>;
} & {
"clips remove": Option<{
clipId: "number";
}, {}>;
} & {
"clips clear": Option<{}, {}>;
} & {
"transport info": Option<{}, {
status: "transportstatus";
speed: "number";
slotId: "number";
clipId: "number";
singleClip: "boolean";
displayTimecode: "timecode";
timecode: "timecode";
videoFormat: "videoformat";
loop: "boolean";
}>;
} & {
"slot info": Option<{
slotId: "number";
}, {
slotId: "number";
status: "slotstatus";
volumeName: "string";
recordingTime: "timecode";
videoFormat: "videoformat";
}>;
} & {
"slot select": Option<{
slotId: "number";
videoFormat: "videoformat";
}, {}>;
} & {
"slot unblock": Option<{
slotId: "number";
}, {}>;
} & {
"dynamic range": Option<{
playbackOverride: "string";
}, {}>;
} & {
notify: Option<{
remote: "boolean";
transport: "boolean";
slot: "boolean";
configuration: "boolean";
droppedFrames: "boolean";
displayTimecode: "boolean";
timelinePosition: "boolean";
playrange: "boolean";
dynamicRange: "boolean";
}, {
remote: "boolean";
transport: "boolean";
slot: "boolean";
configuration: "boolean";
droppedFrames: "boolean";
displayTimecode: "boolean";
timelinePosition: "boolean";
playrange: "boolean";
dynamicRange: "boolean";
}>;
} & {
goto: Option<{
clipId: "number";
clip: "goto";
timeline: "goto";
timecode: "timecode";
slotId: "number";
}, {}>;
} & {
jog: Option<{
timecode: "timecode";
}, {}>;
} & {
shuttle: Option<{
speed: "number";
}, {}>;
} & {
remote: Option<{
enable: "boolean";
override: "boolean";
}, {}>;
} & {
configuration: Option<{
videoInput: "videoinput";
audioInput: "audioinput";
fileFormat: "fileformat";
audioCodec: "audiocodec";
timecodeInput: "timecodeinput";
timecodePreset: "timecode";
audioInputChannels: "number";
recordTrigger: "recordtrigger";
recordPrefix: "string";
appendTimestamp: "boolean";
}, {
videoInput: "videoinput";
audioInput: "audioinput";
fileFormat: "fileformat";
audioCodec: "audiocodec";
timecodeInput: "timecodeinput";
timecodePreset: "timecode";
audioInputChannels: "number";
recordTrigger: "recordtrigger";
recordPrefix: "string";
appendTimestamp: "boolean";
}>;
} & {
uptime: Option<{}, {
uptime: "number";
}>;
} & {
format: Option<{
prepare: "string";
confirm: "string";
}, {
token: "string";
}>;
} & {
identify: Option<{
enable: "boolean";
}, {}>;
} & {
watchdog: Option<{
period: "number";
}, {}>;
}>;
declare type CommandConfigs = {
[K in keyof typeof api['options']]: typeof api['options'][K];
};
export declare const paramsByCommandName: {
help: Record<string, ParamInfo>;
commands: Record<string, ParamInfo>;
"device info": Record<string, ParamInfo>;
"disk list": Record<string, ParamInfo>;
quit: Record<string, ParamInfo>;
ping: Record<string, ParamInfo>;
preview: Record<string, ParamInfo>;
play: Record<string, ParamInfo>;
playrange: Record<string, ParamInfo>;
"playrange set": Record<string, ParamInfo>;
"playrange clear": Record<string, ParamInfo>;
"play on startup": Record<string, ParamInfo>;
"play option": Record<string, ParamInfo>;
record: Record<string, ParamInfo>;
"record spill": Record<string, ParamInfo>;
stop: Record<string, ParamInfo>;
"clips count": Record<string, ParamInfo>;
"clips get": Record<string, ParamInfo>;
"clips add": Record<string, ParamInfo>;
"clips remove": Record<string, ParamInfo>;
"clips clear": Record<string, ParamInfo>;
"transport info": Record<string, ParamInfo>;
"slot info": Record<string, ParamInfo>;
"slot select": Record<string, ParamInfo>;
"slot unblock": Record<string, ParamInfo>;
"dynamic range": Record<string, ParamInfo>;
notify: Record<string, ParamInfo>;
goto: Record<string, ParamInfo>;
jog: Record<string, ParamInfo>;
shuttle: Record<string, ParamInfo>;
remote: Record<string, ParamInfo>;
configuration: Record<string, ParamInfo>;
uptime: Record<string, ParamInfo>;
format: Record<string, ParamInfo>;
identify: Record<string, ParamInfo>;
watchdog: Record<string, ParamInfo>;
};
export declare type CommandName = keyof CommandConfigs;
export declare type CommandParamsByCommandName = {
[K in CommandName]: ArgsTypes<NonNullable<CommandConfigs[K]['arguments']>>;
};
export declare type CommandResponsesByCommandName = {
[K in CommandName]: ArgsTypes<NonNullable<CommandConfigs[K]['returnValue']>>;
};
export declare function assertValidCommandName(value: any): asserts value is CommandName;
export {};
//# sourceMappingURL=api.d.ts.map