import { createXHRClient, createXHRConnection, TBinaryProtocol, TJSONProtocol, XHRConnection, type ConnectOptions, } from 'thrift'; import { App, inject } from 'vue'; import { defaultClientOptions } from './defaults'; import { defaultHubInit, ThriftHub } from './hub'; import { ServiceType } from './service_type'; export type ClientOptions = ConnectOptions & { host: string; port: number; }; const hubProvideKey = 'thrift_hub'; export function useHub(): ThriftHub { return inject(hubProvideKey) || defaultHubInit(); } export default { install: (app: App, opts: Map = defaultClientOptions) => { app.provide(hubProvideKey, defaultHubInit(opts)); }, };