@@ -19,12 +19,87 @@ 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+ // Provenance is always propagated
25+ readonly provenance : Provenance ;
26+ }
27+
28+ export interface SourceModeledMethod extends MethodSignature {
29+ readonly type : "source" ;
30+ readonly output : string ;
31+ readonly kind : ModeledMethodKind ;
32+ readonly provenance : Provenance ;
33+ }
34+
35+ export interface SinkModeledMethod extends MethodSignature {
36+ readonly type : "sink" ;
37+ readonly input : string ;
38+ readonly kind : ModeledMethodKind ;
39+ readonly provenance : Provenance ;
40+ }
41+
42+ export interface SummaryModeledMethod extends MethodSignature {
43+ readonly type : "summary" ;
2444 readonly input : string ;
2545 readonly output : string ;
2646 readonly kind : ModeledMethodKind ;
2747 readonly provenance : Provenance ;
2848}
2949
50+ export interface NeutralModeledMethod extends MethodSignature {
51+ readonly type : "neutral" ;
52+ readonly kind : ModeledMethodKind ;
53+ readonly provenance : Provenance ;
54+ }
55+
56+ export type ModeledMethod =
57+ | NoneModeledMethod
58+ | SourceModeledMethod
59+ | SinkModeledMethod
60+ | SummaryModeledMethod
61+ | NeutralModeledMethod ;
62+
3063export type ModeledMethodKind = string ;
64+
65+ export function modeledMethodSupportsKind (
66+ modeledMethod : ModeledMethod ,
67+ ) : modeledMethod is
68+ | SourceModeledMethod
69+ | SinkModeledMethod
70+ | SummaryModeledMethod
71+ | NeutralModeledMethod {
72+ return (
73+ modeledMethod . type === "source" ||
74+ modeledMethod . type === "sink" ||
75+ modeledMethod . type === "summary" ||
76+ modeledMethod . type === "neutral"
77+ ) ;
78+ }
79+
80+ export function modeledMethodSupportsInput (
81+ modeledMethod : ModeledMethod ,
82+ ) : modeledMethod is SinkModeledMethod | SummaryModeledMethod {
83+ return modeledMethod . type === "sink" || modeledMethod . type === "summary" ;
84+ }
85+
86+ export function modeledMethodSupportsOutput (
87+ modeledMethod : ModeledMethod ,
88+ ) : modeledMethod is SourceModeledMethod | SummaryModeledMethod {
89+ return modeledMethod . type === "source" || modeledMethod . type === "summary" ;
90+ }
91+
92+ export function modeledMethodSupportsProvenance (
93+ modeledMethod : ModeledMethod ,
94+ ) : modeledMethod is
95+ | SourceModeledMethod
96+ | SinkModeledMethod
97+ | SummaryModeledMethod
98+ | NeutralModeledMethod {
99+ return (
100+ modeledMethod . type === "source" ||
101+ modeledMethod . type === "sink" ||
102+ modeledMethod . type === "summary" ||
103+ modeledMethod . type === "neutral"
104+ ) ;
105+ }
0 commit comments