UNPKG

@bbc/sofie-server-core-integration

Version:
38 lines 2.04 kB
import { PeripheralDeviceId } from '@bbc/sofie-shared-lib/dist/core/model/Ids'; import { NewPeripheralDeviceAPI, PeripheralDeviceAPIMethods } from '@bbc/sofie-shared-lib/dist/peripheralDevice/methodsAPI'; import { CoreConnection, CoreCredentials } from './coreConnection.js'; import { DDPConnector } from './ddpConnector.js'; export declare function makeMethods(connection: Pick<CoreConnection, 'callMethodRaw'>, methods: object): any; export declare function makeMethodsLowPrio(connection: Pick<CoreConnection, 'callMethodLowPrioRaw'>, methods: object): any; type ParametersExceptDeviceIds<F> = F extends (deviceId: PeripheralDeviceId, deviceToken: string, ...rest: infer R) => any ? R : never; type ExecutableFunction<T extends keyof NewPeripheralDeviceAPI> = (...args: ParametersExceptDeviceIds<NewPeripheralDeviceAPI[T]>) => Promise<ReturnType<NewPeripheralDeviceAPI[T]>>; /** * Translate NewPeripheralDeviceAPI, to remove the deviceId and deviceToken parameters at the start, as they will be injected by the */ export type ExternalPeripheralDeviceAPI = { [T in keyof NewPeripheralDeviceAPI]: ExecutableFunction<T>; }; export declare const TIMEOUTCALL = 200; export declare const TIMEOUTREPLY = 50; export declare class ConnectionMethodsQueue { private _triggerDoQueueTimer; private _timeLastMethodCall; private _timeLastMethodReply; private queuedMethodCalls; private _ddp; private _credentials; constructor(ddp: DDPConnector, credentials: CoreCredentials); /** * This should not be used directly, use the `coreMethods` wrapper instead. * Call a meteor method * @param methodName The name of the method to call * @param attrs Parameters to the method * @returns Resopnse, if any */ callMethodRaw(methodName: string, attrs: Array<any>): Promise<any>; callMethodLowPrioRaw(methodName: PeripheralDeviceAPIMethods | string, attrs: Array<any>): Promise<any>; private _triggerDoQueue; private _doQueue; } export {}; //# sourceMappingURL=methods.d.ts.map