UNPKG

@wandelbots/nova-js

Version:

Official JS client for the Wandelbots API

67 lines 2.63 kB
import type { Configuration as BaseConfiguration } from "@wandelbots/nova-api/v1"; import { AutoReconnectingWebsocket } from "../AutoReconnectingWebsocket.js"; import { ConnectedMotionGroup } from "./ConnectedMotionGroup.js"; import { JoggerConnection } from "./JoggerConnection.js"; import { MotionStreamConnection } from "./MotionStreamConnection.js"; import { NovaCellAPIClient } from "./NovaCellAPIClient.js"; import { MockNovaInstance } from "./mock/MockNovaInstance.js"; export type NovaClientConfig = { /** * Url of the deployed Nova instance to connect to * e.g. https://saeattii.instance.wandelbots.io */ instanceUrl: string | "https://mock.example.com"; /** * Identifier of the cell on the Nova instance to connect this client to. * If omitted, the default identifier "cell" is used. **/ cellId?: string; /** * Username for basic auth to the Nova instance. * @deprecated use accessToken instead */ username?: string; /** * Password for basic auth to the Nova instance. * @deprecated use accessToken instead */ password?: string; /** * Access token for Bearer authentication. */ accessToken?: string; } & Omit<BaseConfiguration, "isJsonMime" | "basePath">; type NovaClientConfigWithDefaults = NovaClientConfig & { cellId: string; }; /** * Client for connecting to a Nova instance and controlling robots. */ export declare class NovaClient { readonly api: NovaCellAPIClient; readonly config: NovaClientConfigWithDefaults; readonly mock?: MockNovaInstance; authPromise: Promise<string | null> | null; accessToken: string | null; constructor(config: NovaClientConfig); renewAuthentication(): Promise<void>; makeWebsocketURL(path: string): string; /** * Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance. * If you explicitly want to reconnect an existing websocket, call `reconnect` * on the returned object. */ openReconnectingWebsocket(path: string): AutoReconnectingWebsocket; /** * Connect to the motion state websocket(s) for a given motion group */ connectMotionStream(motionGroupId: string): Promise<MotionStreamConnection>; /** * Connect to the jogging websocket(s) for a given motion group */ connectJogger(motionGroupId: string): Promise<JoggerConnection>; connectMotionGroups(motionGroupIds: string[]): Promise<ConnectedMotionGroup[]>; connectMotionGroup(motionGroupId: string): Promise<ConnectedMotionGroup>; } export {}; //# sourceMappingURL=NovaClient.d.ts.map