Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

Commit 37d4f31

Browse files
Louis Cibotpylebecq
authored andcommitted
fix job contains a null ID
1 parent fbc0a58 commit 37d4f31

File tree

1 file changed

+17
-46
lines changed

1 file changed

+17
-46
lines changed

src/Code/serverless/Client/Alfred.js

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { GraphQLClient } = require("graphql-request");
22
const { serializer, versioner } = require("../Services");
3-
const Job = require("./Job");
43
const {
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

Comments
 (0)