UNPKG

signalk-server

Version:

An implementation of a [Signal K](http://signalk.org) server for boats.

91 lines 2.23 kB
/** * WASM Plugin Types * * Shared type definitions for WASM plugin system */ /** * Capabilities that can be granted to WASM plugins */ export interface WasmCapabilities { network: boolean; storage: 'vfs-only' | 'none'; dataRead: boolean; dataWrite: boolean; serialPorts: boolean; putHandlers: boolean; httpEndpoints?: boolean; resourceProvider?: boolean; weatherProvider?: boolean; radarProvider?: boolean; rawSockets?: boolean; } /** * WASM binary format types */ export type WasmFormat = 'wasi-p1' | 'unknown'; /** * WASM plugin instance representing a loaded plugin */ export interface WasmPluginInstance { pluginId: string; wasmPath: string; vfsRoot: string; capabilities: WasmCapabilities; format: WasmFormat; wasi: any; module: WebAssembly.Module; instance: WebAssembly.Instance; exports: WasmPluginExports; asLoader?: any; setAsyncifyResume?: (fn: (() => any) | null) => void; } /** * Standard exports expected from a WASM plugin */ export interface WasmPluginExports { id: () => string; name: () => string; schema: () => string; start: (config: string) => number | Promise<number>; stop: () => number; memory?: WebAssembly.Memory; http_endpoints?: () => string; poll?: () => number; delta_handler?: (deltaJson: string) => void; } /** * Resource provider registration from a WASM plugin */ export interface WasmResourceProvider { pluginId: string; resourceType: string; pluginInstance: WasmPluginInstance | null; } /** * Weather provider registration from a WASM plugin */ export interface WasmWeatherProvider { pluginId: string; providerName: string; pluginInstance: WasmPluginInstance | null; } /** * Radar provider registration from a WASM plugin */ export interface WasmRadarProvider { pluginId: string; providerName: string; pluginInstance: WasmPluginInstance | null; } /** * Context passed to loader functions */ export interface LoaderContext { pluginId: string; wasmPath: string; vfsRoot: string; capabilities: WasmCapabilities; app?: any; debug: (...args: any[]) => void; } //# sourceMappingURL=types.d.ts.map