@@ -19,12 +19,85 @@ export type Provenance =
1919 // Entered by the user in the editor manually
2020 | "manual" ;
2121
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" ;
2442 readonly input : string ;
2543 readonly output : string ;
2644 readonly kind : ModeledMethodKind ;
2745 readonly provenance : Provenance ;
2846}
2947
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+
3061export 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