import type { OnErrorCallback, OnResponseCallback, ProtobufBase64, Spec, UnsubscribeFromStream, WriteableStream, } from "../../core/NativeTurboLnd"; export type ElectrobunBackendName = "bunffi" | "napi"; export type ElectrobunMethodLists< UnaryMethod extends string, ServerStreamMethod extends string, BidiStreamMethod extends string, > = { unaryMethods: readonly UnaryMethod[]; serverStreamMethods: readonly ServerStreamMethod[]; bidiStreamMethods: readonly BidiStreamMethod[]; }; export type ElectrobunBackendDriver< UnaryMethod extends string, ServerStreamMethod extends string, BidiStreamMethod extends string, > = { start(args: string): Promise; invokeUnary( method: UnaryMethod, request: ProtobufBase64 ): Promise; openServerStream( method: ServerStreamMethod, data: ProtobufBase64, onResponse: OnResponseCallback, onError: OnErrorCallback ): UnsubscribeFromStream; openBidiStream( method: BidiStreamMethod, onResponse: OnResponseCallback, onError: OnErrorCallback ): WriteableStream; }; export type ElectrobunBackendSpec< UnaryMethod extends string, ServerStreamMethod extends string, BidiStreamMethod extends string, > = Pick & Record Promise> & Record< ServerStreamMethod, ( data: ProtobufBase64, onResponse: OnResponseCallback, onError: OnErrorCallback ) => UnsubscribeFromStream > & Record< BidiStreamMethod, ( onResponse: OnResponseCallback, onError: OnErrorCallback ) => WriteableStream >;