/
checker-interfaces.ts
executable file
·146 lines (120 loc) · 5.22 KB
/
checker-interfaces.ts
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import * as THREE from 'three';
// ObjectId
export type CheckerModuleType = 'filter' | 'extract' | 'math' | 'reducer' | 'if' | 'projection' | 'distance' | 'normal-distance' | 'output';
export const CheckerModuleTypeOptions = ['filter', 'extract', 'math', 'reducer', 'if', 'projection', 'distance', 'normal-distance', 'output'];
export type CheckerModuleIOType = 'scene' | 'three-objects' | 'three-object' | 'triangles' | 'triangle' | 'line3s' | 'line3' | 'vector3s' | 'vector3' | 'vector2s' | 'vector2' | 'box3s' | 'box3' | 'strings' | 'string' | 'numbers' | 'number' | 'booleans' | 'boolean' | 'json';
export const CheckerModuleIOTypeOptions = ['scene', 'three-objects', 'three-object', 'triangles', 'triangle', 'line3s', 'line3', 'vector3s', 'vector3', 'vector2s', 'vector2', 'box3s', 'box3', 'strings', 'string', 'numbers', 'number', 'booleans', 'boolean', 'json'];
export type CheckerModuleIOTypeValue = THREE.Scene | THREE.Object3D[] | THREE.Object3D | THREE.Triangle | THREE.Triangle[] | THREE.Line3 | THREE.Line3[] | THREE.Vector3 | THREE.Vector3[] | THREE.Vector2 | THREE.Vector2[] | THREE.Box3 | THREE.Box3[] | string[] | string | number[] | number | boolean[] | boolean | CheckerJsonOutput[];
export type CheckerModuleIOStyle = 'default' | 'correct' | 'incorrect' | 'danger';
export const CheckerModuleIOStyleOptions = ['default', 'correct', 'incorrect', 'danger'];
export interface CheckerJsonOutput {
prefix: string;
value: any;
type: CheckerModuleIOType;
ref: CheckerModuleIORef | CheckerModuleIORef[];
style?: CheckerModuleIOStyle | CheckerModuleIOStyle[];
suffix: string;
display: 'paragraph' | 'blocks';
}
export type ReportOutput = {
name: string;
description: string;
flows: FlowOutput[]
};
export type FlowOutput = {
name: string;
description: string;
summaries: string[],
outputs: {name: string, outputs: CheckerJsonOutput[]}[]
};
export type CheckerConditionOperator = 'or' | 'and';
export type CheckerExtractType = 'faces' | 'edges' | 'vertices' | 'wireframe' | 'property';
export const CheckerExtractTypeOptions = ['faces', 'edges', 'vertices', 'wireframe', 'property'];
export interface CheckerObjectCondition {
key: string;
operation: string;
value: string | Date;
}
export interface CheckerValueCondition {
operation: string;
value: string | Date;
}
export abstract class CheckerModule {
public abstract process(): Promise<void>;
}
export type CheckerModuleIORef = THREE.Object3D | THREE.Object3D[] | undefined;
export interface CheckerModuleBase {
moduleType: CheckerModuleType;
name: string;
allowedInputTypes?: Array<CheckerModuleIOType>;
inputVarName?: string;
outputVarName: string;
outputType: CheckerModuleIOType;
outputValue: CheckerModuleIOTypeValue;
outputReference: CheckerModuleIORef | CheckerModuleIORef[];
outputSummary?: string;
}
export interface CheckerModuleFilter extends CheckerModuleBase {
// allowedInputType = ['three-objects'];
conditions: Array<CheckerObjectCondition>;
conditionsOperator: CheckerConditionOperator;
// outputType = 'three-objects';
}
export interface CheckerModuleExtract extends CheckerModuleBase {
// allowedInputType = ['three-objects', 'three-object'];
extractType: CheckerExtractType;
value: any;
forceOutputAsNumber: boolean;
// outputType = 'numbers' | 'strings' | 'booleans';
}
export interface CheckerModuleMath extends CheckerModuleBase {
// allowedInputType = ['numbers', 'number'];
expression: string;
// outputType = 'numbers' | 'number';
}
export type CheckerModuleReducerOperation = 'min' | 'max' | 'average' | 'count' | 'sum';
export const CheckerModuleReducerOperationOptions = ['min', 'max', 'average', 'count', 'sum'];
export interface CheckerModuleReducer extends CheckerModuleBase {
// allowedInputType = ['numbers', 'number'];
operation: CheckerModuleReducerOperation;
// outputType = 'numbers' | 'number';
}
export type CheckerModuleIfOperation = {
conditions: Array<CheckerValueCondition>;
conditionsOperator: CheckerConditionOperator;
outputValue: number | string | boolean;
outputStyle: CheckerModuleIOStyle;
}
export type CheckerModuleIfOperations = Array<CheckerModuleIfOperation>;
export interface CheckerModuleIf extends CheckerModuleBase {
// allowedInputType = ['numbers', 'number'];
defaultOutputValue: number | string | boolean;
defaultOutputStyle: CheckerModuleIOStyle;
operations: CheckerModuleIfOperations;
// outputType = 'numbers' | 'strings' | 'booleans';
}
export interface CheckerModuleBbbox extends CheckerModuleBase {
}
export interface CheckerModuleProjection extends CheckerModuleBase {
projectionAxis: 'x' | 'y' | 'z';
}
export interface CheckerModuleDistance extends CheckerModuleBase {
distanceType: '2d-2d' | '3d-3d';
}
export interface CheckerModuleNormalDistance extends CheckerModuleBase {
operation: 'min' | 'max';
}
export interface CheckerOutput {
prefix: string;
varName: string;
suffix: string;
display: 'paragraph' | 'blocks';
}
export interface CheckerModuleOutput extends CheckerModuleBase {
outputs: CheckerOutput[];
}
export interface CheckerFlow {
name: string;
description: string;
modulesIds: Array<string>;
}