flowscale 1.0.17-beta.5 → 1.0.17-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +12 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -174,27 +174,24 @@ var FlowscaleAPI = /** @class */ (function () {
174
174
  attempts = 0;
175
175
  _c.label = 2;
176
176
  case 2:
177
- if (!true) return [3 /*break*/, 11];
177
+ if (!true) return [3 /*break*/, 8];
178
178
  if (Date.now() - startTime > timeoutMs) {
179
179
  throw new Error("Workflow execution timed out after ".concat(timeoutMs, "ms"));
180
180
  }
181
181
  _c.label = 3;
182
182
  case 3:
183
- _c.trys.push([3, 8, , 9]);
183
+ _c.trys.push([3, 5, , 6]);
184
184
  return [4 /*yield*/, this.getOutput(outputName)];
185
185
  case 4:
186
186
  output = _c.sent();
187
187
  console.log("DEBUG:", output);
188
- if (!output) return [3 /*break*/, 7];
189
- if (!(output.status === 'in_progress')) return [3 /*break*/, 6];
190
- attempts++;
191
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, pollIntervalMs); })];
188
+ if (output) {
189
+ if (output.status === 'success') {
190
+ return [2 /*return*/, output]; // Return the output if successful
191
+ }
192
+ }
193
+ return [3 /*break*/, 6];
192
194
  case 5:
193
- _c.sent();
194
- _c.label = 6;
195
- case 6: return [2 /*return*/, output]; // Return the output when available
196
- case 7: return [3 /*break*/, 9];
197
- case 8:
198
195
  error_1 = _c.sent();
199
196
  // Log the error but continue polling
200
197
  console.warn("Error polling for output (attempt ".concat(attempts, "):"), error_1);
@@ -202,16 +199,16 @@ var FlowscaleAPI = /** @class */ (function () {
202
199
  if (attempts > 5) {
203
200
  pollIntervalMs = Math.min(pollIntervalMs * 1.5, 10000); // Increase interval, max 10s
204
201
  }
205
- return [3 /*break*/, 9];
206
- case 9:
202
+ return [3 /*break*/, 6];
203
+ case 6:
207
204
  attempts++;
208
205
  // Wait for the polling interval
209
206
  return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, pollIntervalMs); })];
210
- case 10:
207
+ case 7:
211
208
  // Wait for the polling interval
212
209
  _c.sent();
213
210
  return [3 /*break*/, 2];
214
- case 11: return [2 /*return*/];
211
+ case 8: return [2 /*return*/];
215
212
  }
216
213
  });
217
214
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowscale",
3
- "version": "1.0.17-beta.5",
3
+ "version": "1.0.17-beta.6",
4
4
  "description": "An NPM library for communicating with the Flowscale APIs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",