11const { GraphQLClient } = require ( "graphql-request" ) ;
22const { serializer, versioner } = require ( "../Services" ) ;
3- const Job = require ( "./Job" ) ;
43const {
54 ExternalZenatonError,
65 InternalZenatonError,
@@ -38,13 +37,10 @@ const Alfred = class Alfred {
3837 input : body [ ATTR_INPUT ] ,
3938 } ,
4039 } ;
41- const job = new Job ( ) ;
42- const promise = this . _request ( endpoint , mutation , variables ) . then (
40+
41+ return this . _request ( endpoint , mutation , variables ) . then (
4342 ( res ) => res . dispatchTask ,
4443 ) ;
45- job . promise = promise ;
46-
47- return job ;
4844 }
4945
5046 /**
@@ -63,13 +59,10 @@ const Alfred = class Alfred {
6359 input : body [ ATTR_INPUT ] ,
6460 } ,
6561 } ;
66- const job = new Job ( ) ;
67- const promise = this . _request ( endpoint , mutation , variables ) . then (
62+
63+ return this . _request ( endpoint , mutation , variables ) . then (
6864 ( res ) => res . createTaskSchedule ,
6965 ) ;
70- job . promise = promise ;
71-
72- return job ;
7366 }
7467
7568 /**
@@ -89,13 +82,10 @@ const Alfred = class Alfred {
8982 version : body [ ATTR_VERSION ] ,
9083 } ,
9184 } ;
92- const job = new Job ( ) ;
93- const promise = this . _request ( endpoint , mutation , variables ) . then (
85+
86+ return this . _request ( endpoint , mutation , variables ) . then (
9487 ( res ) => res . dispatchWorkflow ,
9588 ) ;
96- job . promise = promise ;
97-
98- return job ;
9989 }
10090
10191 /**
@@ -116,13 +106,10 @@ const Alfred = class Alfred {
116106 version : body [ ATTR_VERSION ] ,
117107 } ,
118108 } ;
119- const job = new Job ( ) ;
120- const promise = this . _request ( endpoint , mutation , variables ) . then (
109+
110+ return this . _request ( endpoint , mutation , variables ) . then (
121111 ( res ) => res . scheduleWorkflow ,
122112 ) ;
123- job . promise = promise ;
124-
125- return job ;
126113 }
127114
128115 /**
@@ -140,13 +127,9 @@ const Alfred = class Alfred {
140127 } ,
141128 } ;
142129
143- const job = new Job ( ) ;
144- const promise = this . _request ( endpoint , mutation , variables ) . then (
130+ return this . _request ( endpoint , mutation , variables ) . then (
145131 ( res ) => res . killWorkflows ,
146132 ) ;
147- job . promise = promise ;
148-
149- return job ;
150133 }
151134
152135 /**
@@ -162,13 +145,10 @@ const Alfred = class Alfred {
162145 selector : query ,
163146 } ,
164147 } ;
165- const job = new Job ( ) ;
166- const promise = this . _request ( endpoint , mutation , variables ) . then (
148+
149+ return this . _request ( endpoint , mutation , variables ) . then (
167150 ( res ) => res . pauseWorkflows ,
168151 ) ;
169- job . promise = promise ;
170-
171- return job ;
172152 }
173153
174154 /**
@@ -184,13 +164,10 @@ const Alfred = class Alfred {
184164 selector : query ,
185165 } ,
186166 } ;
187- const job = new Job ( ) ;
188- const promise = this . _request ( endpoint , mutation , variables ) . then (
167+
168+ return this . _request ( endpoint , mutation , variables ) . then (
189169 ( res ) => res . resumeWorkflows ,
190170 ) ;
191- job . promise = promise ;
192-
193- return job ;
194171 }
195172
196173 /**
@@ -209,13 +186,10 @@ const Alfred = class Alfred {
209186 selector : query ,
210187 } ,
211188 } ;
212- const job = new Job ( ) ;
213- const promise = this . _request ( endpoint , mutation , variables ) . then (
189+
190+ return this . _request ( endpoint , mutation , variables ) . then (
214191 ( res ) => res . sendEventToWorkflows ,
215192 ) ;
216- job . promise = promise ;
217-
218- return job ;
219193 }
220194
221195 /**
@@ -234,13 +208,10 @@ const Alfred = class Alfred {
234208 selector : { id } ,
235209 } ,
236210 } ;
237- const job = new Job ( ) ;
238- const promise = this . _request ( endpoint , mutation , variables ) . then (
211+
212+ return this . _request ( endpoint , mutation , variables ) . then (
239213 ( res ) => res . sendEventToWorkflows ,
240214 ) ;
241- job . promise = promise ;
242-
243- return job ;
244215 }
245216
246217 _getGatewayUrl ( ) {
0 commit comments