File size: 734 Bytes
1b756c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { ClassicPreset } from 'rete';
import type { NodeCategory, NodeMeta, SocketData } from '../types';

export abstract class BaseWorkflowNode extends ClassicPreset.Node {
  abstract readonly category: NodeCategory;
  abstract readonly icon: string;
  abstract readonly description: string;

  width = 280;
  height = 140;
  execStatus: 'idle' | 'running' | 'completed' | 'error' = 'idle';

  constructor(label: string) {
    super(label);
  }

  abstract data(
    inputs: Record<string, SocketData[]>
  ): Promise<Record<string, SocketData>>;

  getMeta(): NodeMeta {
    return {
      id: this.id,
      label: this.label,
      category: this.category,
      icon: this.icon,
      description: this.description,
    };
  }
}