UNPKG

@wandelbots/nova-js

Version:

Official JS client for the Wandelbots API

73 lines (72 loc) 3.23 kB
import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-Qcrbm3Kb.cjs"; import { d as poseToWandelscriptString, n as NovaClientConfig, t as NovaClient } from "./NovaClient-CV7ooIkD.cjs"; //#region src/lib/availableStorage.d.ts /** * Safety wrapper around browser localStorage providing context availability * checks and JSON parsing */ declare class AvailableStorage { available: boolean; getJSON<T>(key: string): Partial<T> | null; setJSON(key: string, obj: unknown): null | undefined; delete(key: string): null | undefined; setString(key: string, value: string): null | undefined; getString(key: string): string | null; } declare const availableStorage: AvailableStorage; //#endregion //#region src/lib/converters.d.ts /** Try to parse something as JSON; return undefined if we can't */ declare function tryParseJson(json: unknown): any; /** Try to turn something into JSON; return undefined if we can't */ declare function tryStringifyJson(json: unknown): string | undefined; /** * Converts object parameters to query string. * e.g. { a: "1", b: "2" } => "?a=1&b=2" * {} => "" */ declare function makeUrlQueryString(obj: Record<string, string>): string; /** Convert radians to degrees */ declare function radiansToDegrees(radians: number): number; /** Convert degrees to radians */ declare function degreesToRadians(degrees: number): number; /** * Check for coordinate system id equivalence, accounting for the "world" default * on empty/undefined values. */ declare function isSameCoordinateSystem(firstCoordSystem: string | undefined, secondCoordSystem: string | undefined): boolean; /** * Helpful const for converting {x, y, z} to [x, y, z] and vice versa */ declare const XYZ_TO_VECTOR: { x: number; y: number; z: number; }; //#endregion //#region src/lib/errorHandling.d.ts declare function delay(ms: number): Promise<unknown>; /** * @deprecated Use makeErrorMessage instead and truncate the error for display as needed, or make a situation-specific localized error message based on a response code */ declare function makeShortErrorMessage(err: unknown): string; /** * Attempts to make a helpful error message from an unknown thrown error * or promise rejection. * * This function is mainly to aid debugging and good bug reports. For * expected errors encountered by end users, it's more ideal to catch * the specific error code and provide a localized app-specific error message. */ declare function makeErrorMessage(err: unknown): string; //#endregion //#region src/LoginWithAuth0.d.ts /** * Initializes Auth0 login process using redirect if necessary and retrieves an access token. * Returns null when an access token should not be needed to authenticate (i.e. cookie auth * when deployed on the instance domain) */ declare const loginWithAuth0: (instanceUrl: string) => Promise<string | null>; //#endregion export { AutoReconnectingWebsocket, NovaClient, NovaClientConfig, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeShortErrorMessage, makeUrlQueryString, poseToWandelscriptString, radiansToDegrees, tryParseJson, tryStringifyJson }; //# sourceMappingURL=index.d.cts.map