@@ -19,12 +19,85 @@ export type Provenance =
19
19
// Entered by the user in the editor manually
20
20
| "manual" ;
21
21
22
- export interface ModeledMethod extends MethodSignature {
23
- readonly type : ModeledMethodType ;
22
+ export interface NoneModeledMethod extends MethodSignature {
23
+ readonly type : "none" ;
24
+ }
25
+
26
+ export interface SourceModeledMethod extends MethodSignature {
27
+ readonly type : "source" ;
28
+ readonly output : string ;
29
+ readonly kind : ModeledMethodKind ;
30
+ readonly provenance : Provenance ;
31
+ }
32
+
33
+ export interface SinkModeledMethod extends MethodSignature {
34
+ readonly type : "sink" ;
35
+ readonly input : string ;
36
+ readonly kind : ModeledMethodKind ;
37
+ readonly provenance : Provenance ;
38
+ }
39
+
40
+ export interface SummaryModeledMethod extends MethodSignature {
41
+ readonly type : "summary" ;
24
42
readonly input : string ;
25
43
readonly output : string ;
26
44
readonly kind : ModeledMethodKind ;
27
45
readonly provenance : Provenance ;
28
46
}
29
47
48
+ export interface NeutralModeledMethod extends MethodSignature {
49
+ readonly type : "neutral" ;
50
+ readonly kind : ModeledMethodKind ;
51
+ readonly provenance : Provenance ;
52
+ }
53
+
54
+ export type ModeledMethod =
55
+ | NoneModeledMethod
56
+ | SourceModeledMethod
57
+ | SinkModeledMethod
58
+ | SummaryModeledMethod
59
+ | NeutralModeledMethod ;
60
+
30
61
export type ModeledMethodKind = string ;
62
+
63
+ export function modeledMethodSupportsKind (
64
+ modeledMethod : ModeledMethod ,
65
+ ) : modeledMethod is
66
+ | SourceModeledMethod
67
+ | SinkModeledMethod
68
+ | SummaryModeledMethod
69
+ | NeutralModeledMethod {
70
+ return (
71
+ modeledMethod . type === "source" ||
72
+ modeledMethod . type === "sink" ||
73
+ modeledMethod . type === "summary" ||
74
+ modeledMethod . type === "neutral"
75
+ ) ;
76
+ }
77
+
78
+ export function modeledMethodSupportsInput (
79
+ modeledMethod : ModeledMethod ,
80
+ ) : modeledMethod is SinkModeledMethod | SummaryModeledMethod {
81
+ return modeledMethod . type === "sink" || modeledMethod . type === "summary" ;
82
+ }
83
+
84
+ export function modeledMethodSupportsOutput (
85
+ modeledMethod : ModeledMethod ,
86
+ ) : modeledMethod is SourceModeledMethod | SummaryModeledMethod {
87
+ return modeledMethod . type === "source" || modeledMethod . type === "summary" ;
88
+ }
89
+
90
+ export function modeledMethodSupportsProvenance (
91
+ modeledMethod : ModeledMethod ,
92
+ ) : modeledMethod is
93
+ | SourceModeledMethod
94
+ | SinkModeledMethod
95
+ | SummaryModeledMethod
96
+ | NeutralModeledMethod {
97
+ return (
98
+ modeledMethod . type === "source" ||
99
+ modeledMethod . type === "sink" ||
100
+ modeledMethod . type === "summary" ||
101
+ modeledMethod . type === "neutral"
102
+ ) ;
103
+ }
0 commit comments