@iotize/tap-scripts
Version:
IoTize Tap scripts
48 lines (47 loc) • 1.96 kB
TypeScript
import { ProgressState } from '@iotize/common/progress/api';
import { CheckInstruction, ConnectInstruction, DisplayInstruction, EndInstruction, GotoInstruction, LabelInstruction, LogoutInstruction, Lwm2mCommandInstruction, OutputFunction, OutputInstruction, WaitInstruction } from './instructions';
export interface TestRunnerIO {
display: DisplayFunction;
output: OutputFunction;
}
export declare type InstructionListType = ProgInstructions[];
export declare enum ComparisonOperatorType {
EQ = "==",
LT = "<",
GT = ">",
GTE = ">=",
LTE = "<=",
NQ = "!=",
NQ2 = "!="
}
export declare type ProgInstructions = LabelInstruction | VisitInstructionReturnType;
export declare type VisitInstructionReturnType = DisplayInstruction | GotoInstruction | Lwm2mCommandInstruction | CheckInstruction | ConnectInstruction | WaitInstruction | LogoutInstruction | OutputInstruction | EndInstruction;
export interface ComparisonNodeType {
endOffset?: number;
right: string | number[];
operator: ComparisonOperatorType;
}
export declare type ConfigureFromScriptEvent = ScriptRunnerEvent | ConfigureFromScriptEventFactoryReset;
export interface ConfigureFromScriptEventFactoryReset {
type: 'factory-reset';
progress: ProgressState;
}
export declare type LogLevel = 'error' | 'verbose' | 'message';
export declare type DisplayFunction = (level: LogLevel, content: string) => any;
export declare type ScriptRunnerEvent = ScriptRunnerEventAfter | ScriptRunnerEventBefore | ScriptRunnerEventEnd;
export interface ScriptRunnerEventBefore {
type: 'before';
progress: ProgressState;
instruction: ProgInstructions;
}
export interface ScriptRunnerEventEnd {
type: 'end';
progress: ProgressState;
resultCode: number;
}
export interface ScriptRunnerEventAfter {
type: 'after';
progress: ProgressState;
instruction: ProgInstructions;
result: any;
}