UNPKG

@iotize/tap

Version:

IoTize Device client for Javascript

60 lines (59 loc) 2.08 kB
import { ProgressState } from '@iotize/common/progress/api'; import { StepOperations } from '@iotize/common/task-manager'; import '@iotize/tap'; import { Tap } from '@iotize/tap'; import '@iotize/tap/service/all'; import { ReadConfigKey, READ_CONFIGURATOR_CONFIG } from './read-configurator-config'; interface ConfigureContext { tap: Tap; } /** * Configure tap from a configuration file schema * */ export declare class TapConfiguratorReader { calls: TapConfiguratorReader.ReadConfig; constructor(calls?: TapConfiguratorReader.ReadConfig); createReadOperations(tap: Tap): TapConfiguratorReader.Runner; protected addConfigurCalls(configureContext: ConfigureContext, calls: TapConfiguratorReader.ReadConfig, operations: TapConfiguratorReader.StepOperationType[], outputConfig: Partial<Record<ReadConfigKey, any>>, tap: Tap): void; protected sleep(delayMs: number): Promise<void>; } export declare namespace TapConfiguratorReader { type ReadConfig = Partial<typeof READ_CONFIGURATOR_CONFIG>; type Event = { step: Step.readKeySuccess; configKey: ReadConfigKey; value: any; progress: ProgressState; } | { step: Step.readKeyError; configKey: ReadConfigKey; error: Error; progress: ProgressState; } | { step: Step.done; config: Partial<Record<ReadConfigKey, any>>; progress: ProgressState; }; interface Options { delayMs: number; } interface Host { /** * Load given URI * Throw error if URI is not found * @param uri */ loadUri(uri: string): Promise<{ buffer: Uint8Array; }>; } enum Step { readKeySuccess = "TapConfiguratorReaderreadKeySuccess", readKeyError = "TapConfiguratorReaderReadKeyError", done = "TapConfiguratorReaderDone" } type StepOperationType = StepOperations.OperationType<Event, any>; type Runner = StepOperations<Event, any>; } export {};