All files types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67                                                                                                                                     
import type { Graph } from './graph';
 
/** One parameter of a node type, as described by node_catalogue::describe(). */
export interface ParamInfo {
  name: string;
  kind: 'text' | 'textarea' | 'number' | 'select' | 'event' | 'user' | 'function' | 'json';
  required: boolean;
  options: string[];
  label: string;
  optionlabels: Record<string, string>;
}
 
/** One entry of the node palette. */
export interface NodeTypeInfo {
  type: string;
  label: string;
  description: string;
  category: string;
  branches: string[];
  params: ParamInfo[];
}
 
export interface EditorData {
  id: number;
  name: string;
  enabled: boolean;
  graph: Graph;
  nodetypes: NodeTypeInfo[];
  events: string[];
  functions: string[];
  strings: Record<string, string>;
  /** Who the workflow runs as, and whether the current user may pick someone else. */
  runasuserid: number;
  runasname: string;
  canchooserunas: boolean;
}
 
export interface SaveRequest {
  id: number;
  name: string;
  enabled: boolean;
  graph: Graph;
  /** 0 for the person saving. */
  runasuserid: number;
}
 
export interface SaveProblem {
  code: string;
  message: string;
  nodeids: string[];
}
 
export interface SaveResult {
  id: number;
  enabled: boolean;
  errors: SaveProblem[];
  runasuserid?: number;
  runasname?: string;
}
 
/** What the editor needs from the server. Tests pass a fake. */
export interface Client {
  load(workflowid: number): Promise<EditorData>;
  save(request: SaveRequest): Promise<SaveResult>;
  run(workflowid: number): Promise<boolean>;
}