flowscale 1.3.5 → 2.0.0

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.0] - 2026-02-08
11
+
12
+ ### 🚨 Breaking Changes
13
+ - `executeWorkflowAsync` now always returns `GetAllOutputsResponse` (array format).
14
+ - Removed legacy boolean 6th argument support in `executeWorkflowAsync`.
15
+ - Removed legacy response types: `LegacyGetOutputResponse` and `DeprecationWarning`.
16
+
17
+ ### 🔄 Changed
18
+ - `ExecuteWorkflowAsyncOptions` now only supports `onIntermediateResponse`.
19
+ - README documentation updated for the v2 async execution API and migration guidance.
20
+
21
+ ## [1.3.5] - 2026-02-08
22
+
10
23
  ### ✨ Added
11
24
  - `executeWorkflowAsync` now supports an options object with `onIntermediateResponse` callback to emit intermediate polling updates.
12
25
  - Added `subscribeRunEvents(runId, options)` to consume run events via SSE (`/api/v1/runs/{run_id}/events`).
@@ -14,6 +27,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
27
  ### 🔄 Changed
15
28
  - `executeWorkflowAsync` still accepts the legacy boolean as the 6th parameter for backward compatibility.
16
29
  - `GetOutputResponse` and `RunDetail` types now include optional progress-related fields returned by the API.
30
+ - `GetAllOutputsResponse` now supports both binary outputs (`download_url`) and text outputs (`file_content`).
31
+
32
+ ### 🐛 Fixed
33
+ - `executeWorkflowAsync` now emits `run_status` updates continuously during polling (not only before output names are discovered).
34
+ - `getOutput` now handles HTTP `204` responses correctly as "not ready", avoiding `status: undefined` output warnings.
35
+ - `executeWorkflowAsync` now returns `file_content` outputs correctly instead of returning entries with `download_url: undefined`.
36
+
37
+ ### 🗑️ Removed
17
38
  - Removed WebSocket APIs from the JavaScript SDK (`connectWebSocket`, `disconnectWebSocket`, `sendWebSocketMessage`, `isWebSocketConnected`) and removed related examples.
18
39
 
19
40
  ## [1.1.0] - 2025-01-29
@@ -38,7 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
38
59
  - Enhanced error messages with better context
39
60
 
40
61
  ### 🗓️ Deprecated
41
- - Legacy single output format in `executeWorkflowAsync` (removal: September 1st, 2025)
62
+ - Legacy single output format in `executeWorkflowAsync` (planned removal: v2.0.0)
42
63
  - Will be completely removed in v2.0.0
43
64
 
44
65
  ### 📚 Documentation
@@ -113,45 +134,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
113
134
 
114
135
  ## Migration Guides
115
136
 
116
- ### From 1.0.x to 1.1.0
137
+ ### From 1.x to 2.0.0
117
138
 
118
- **No breaking changes** - all existing code continues to work.
139
+ `executeWorkflowAsync` no longer returns the legacy single-output object.
119
140
 
120
- #### If you see deprecation warnings:
121
-
122
- **Old code** (still works):
141
+ **Before (v1.x legacy usage):**
123
142
  ```javascript
124
143
  const result = await flowscale.executeWorkflowAsync(workflowId, data);
125
- console.log(result.data.download_url); // Single output
144
+ console.log(result.data.download_url);
126
145
  ```
127
146
 
128
- **New code** (recommended):
147
+ **After (v2.0.0):**
129
148
  ```javascript
130
- const result = await flowscale.executeWorkflowAsync(workflowId, data, groupId, 2000, 600000, true);
149
+ const result = await flowscale.executeWorkflowAsync(workflowId, data);
131
150
  result.data.forEach(output => {
132
- console.log(output.download_url); // Multiple outputs
151
+ console.log(output.download_url || output.file_content);
133
152
  });
134
153
  ```
135
154
 
136
- #### Handling both formats:
137
- ```javascript
138
- const result = await flowscale.executeWorkflowAsync(workflowId, data);
139
-
140
- if (Array.isArray(result.data)) {
141
- // New format - multiple outputs
142
- result.data.forEach(output => console.log(output.download_url));
143
- } else {
144
- // Legacy format - single output
145
- console.log(result.data.download_url);
146
- }
147
- ```
148
-
149
- ### Future Migration (v2.0.0 - September 1st, 2025)
150
-
151
- In v2.0.0, the legacy format will be completely removed:
152
- - `executeWorkflowAsync` will always return array format
153
- - `returnAllOutputs` parameter will be removed
154
- - `LegacyGetOutputResponse` type will be removed
155
+ `returnAllOutputs` and legacy response types are removed in v2.0.0.
155
156
 
156
157
  ---
157
158
 
package/README.md CHANGED
@@ -259,7 +259,7 @@ console.log('Workflow Result:', result);
259
259
 
260
260
  ---
261
261
 
262
- ### 5 `executeWorkflowAsync(workflowId, data, groupId?, pollIntervalMs?, timeoutMs?, returnAllOutputsOrOptions?)`
262
+ ### 5 `executeWorkflowAsync(workflowId, data, groupId?, pollIntervalMs?, timeoutMs?, options?)`
263
263
 
264
264
  **Description:**
265
265
  Execute a workflow and automatically wait for all outputs by polling. This is a convenience method that combines `executeWorkflow` and `getOutput` with automatic polling. Unlike `executeWorkflow`, this method waits for completion and returns the actual workflow outputs.
@@ -270,8 +270,7 @@ Execute a workflow and automatically wait for all outputs by polling. This is a
270
270
  - `groupId` *(string, optional)*: A custom identifier for grouping runs.
271
271
  - `pollIntervalMs` *(number, optional)*: Polling interval in milliseconds (default: 2000).
272
272
  - `timeoutMs` *(number, optional)*: Maximum time to wait for results in milliseconds (default: 600000 - 10 minutes).
273
- - `returnAllOutputsOrOptions` *(boolean | object, optional)*: Backward-compatible boolean (`true`/`false`) or an options object.
274
- - `returnAllOutputs` *(boolean, options only)*: Force return all outputs in new array format (default: auto-detect based on output count).
273
+ - `options` *(object, optional)*: Additional async execution options.
275
274
  - `onIntermediateResponse` *(function, options only)*: Callback fired for intermediate API responses while polling. Useful for queue/progress UI updates.
276
275
 
277
276
  **Usage:**
@@ -303,7 +302,6 @@ const result = await flowscale.executeWorkflowAsync(
303
302
  2000,
304
303
  600000,
305
304
  {
306
- returnAllOutputs: true,
307
305
  onIntermediateResponse: (update) => {
308
306
  // update.type: workflow_submitted | run_status | output_status | poll_retry | completed
309
307
  console.log('Async update:', update);
@@ -323,8 +321,8 @@ const result = await flowscale.executeWorkflowAsync(
323
321
  "generation_status": "success"
324
322
  },
325
323
  {
326
- "filename": "output_image_2.png",
327
- "download_url": "https://runs.s3.amazonaws.com/generations/...",
324
+ "filename": "output_text_1",
325
+ "file_content": "hello world",
328
326
  "generation_status": "success"
329
327
  }
330
328
  ]
@@ -335,41 +333,19 @@ Each output entry contains either:
335
333
  - `download_url` for binary/media outputs
336
334
  - `file_content` for text/non-binary outputs
337
335
 
338
- #### ⚠️ **Migration Notice - executeWorkflowAsync Response Format**
336
+ #### ⚠️ Breaking Change (v2.0.0)
339
337
 
340
- Starting from **v1.0.18**, `executeWorkflowAsync` automatically detects single vs multiple outputs and returns the appropriate format for backward compatibility:
338
+ `executeWorkflowAsync` now always returns array output format (`GetAllOutputsResponse`).
341
339
 
342
- - **Single Output**: Returns legacy format with deprecation warning
343
- - **Multiple Outputs**: Returns new array format
340
+ If you migrated from v1.x and previously accessed `result.data.download_url` directly, update to iterate outputs:
344
341
 
345
- **Legacy Format (Deprecated - will be removed in v2.0.0 on September 1st, 2025):**
346
342
  ```javascript
347
- // Old single output format (still works but shows deprecation warning)
348
343
  const result = await flowscale.executeWorkflowAsync(workflowId, data);
349
- // Returns: { status: "success", data: { download_url: "...", generation_status: "..." }, _deprecation: {...} }
350
- ```
351
-
352
- **New Format (Recommended):**
353
- ```javascript
354
- // Explicitly request new format with all outputs
355
- const result = await flowscale.executeWorkflowAsync(workflowId, data, groupId, 2000, 600000, true);
356
- // Returns: { status: "success", data: [{ filename: "...", download_url: "...", generation_status: "..." }, ...] }
357
-
358
- // Or handle both formats:
359
- if (Array.isArray(result.data)) {
360
- // New format - multiple outputs
361
- result.data.forEach(output => console.log(output.download_url));
362
- } else {
363
- // Legacy format - single output (with deprecation warning)
364
- console.log(result.data.download_url);
365
- }
344
+ result.data.forEach((output) => {
345
+ console.log(output.download_url || output.file_content);
346
+ });
366
347
  ```
367
348
 
368
- **Migration Steps:**
369
- 1. **Immediate**: Your existing code continues working with deprecation warnings
370
- 2. **Short-term**: Update your code to handle the new array format
371
- 3. **Long-term**: Migrate to the new format which supports multiple output
372
-
373
349
  ---
374
350
 
375
351
  ### 6. `getOutput(filename)`
@@ -397,6 +373,8 @@ console.log('Workflow Output:', output);
397
373
  }
398
374
  ```
399
375
 
376
+ For text outputs, `data` may contain `file_content` instead of `download_url`.
377
+
400
378
  ---
401
379
 
402
380
  ### 7. `cancelRun(runId)`
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HealthCheckResponse, QueueResponse, ExecuteWorkflowResponse, GetOutputResponse, GetAllOutputsResponse, LegacyGetOutputResponse, RunDetailResponse, RunListResponse, CancelRunResponse, ExecuteWorkflowAsyncOptions, RunEventsSSEConnection, RunEventsSSEOptions, FlowscaleConfig, WorkflowResponse } from './types';
1
+ import { HealthCheckResponse, QueueResponse, ExecuteWorkflowResponse, GetOutputResponse, GetAllOutputsResponse, RunDetailResponse, RunListResponse, CancelRunResponse, ExecuteWorkflowAsyncOptions, RunEventsSSEConnection, RunEventsSSEOptions, FlowscaleConfig, WorkflowResponse } from './types';
2
2
  export declare class FlowscaleAPI {
3
3
  private apiKey;
4
4
  private baseUrl;
@@ -38,11 +38,11 @@ export declare class FlowscaleAPI {
38
38
  * @param groupId - Optional group ID.
39
39
  * @param pollIntervalMs - Optional polling interval in milliseconds (default: 2000)
40
40
  * @param timeoutMs - Optional timeout in milliseconds (default: 600000 - 10 minutes)
41
- * @param returnAllOutputsOrOptions - Optional legacy boolean flag or options object.
41
+ * @param options - Optional configuration for intermediate responses.
42
42
  */
43
43
  executeWorkflowAsync(workflowId: string, data: {
44
44
  [key: string]: any;
45
- }, groupId?: string, pollIntervalMs?: number, timeoutMs?: number, returnAllOutputsOrOptions?: boolean | ExecuteWorkflowAsyncOptions): Promise<GetAllOutputsResponse | LegacyGetOutputResponse>;
45
+ }, groupId?: string, pollIntervalMs?: number, timeoutMs?: number, options?: ExecuteWorkflowAsyncOptions): Promise<GetAllOutputsResponse>;
46
46
  /**
47
47
  * Retrieves the output of a specific run by providing the filename.
48
48
  * @param filename - The filename of the output to retrieve.
@@ -71,7 +71,6 @@ export declare class FlowscaleAPI {
71
71
  * @returns Connection handle with `close()` and `done` promise.
72
72
  */
73
73
  subscribeRunEvents(runId: string, options?: RunEventsSSEOptions): RunEventsSSEConnection;
74
- private resolveExecuteWorkflowAsyncOptions;
75
74
  private emitExecuteWorkflowAsyncIntermediateResponse;
76
75
  private formatUnknownError;
77
76
  private sleep;
package/dist/index.js CHANGED
@@ -232,17 +232,17 @@ var FlowscaleAPI = /** @class */ (function () {
232
232
  * @param groupId - Optional group ID.
233
233
  * @param pollIntervalMs - Optional polling interval in milliseconds (default: 2000)
234
234
  * @param timeoutMs - Optional timeout in milliseconds (default: 600000 - 10 minutes)
235
- * @param returnAllOutputsOrOptions - Optional legacy boolean flag or options object.
235
+ * @param options - Optional configuration for intermediate responses.
236
236
  */
237
237
  FlowscaleAPI.prototype.executeWorkflowAsync = function (workflowId_1, data_1, groupId_1) {
238
- return __awaiter(this, arguments, void 0, function (workflowId, data, groupId, pollIntervalMs, timeoutMs, returnAllOutputsOrOptions) {
239
- var _a, returnAllOutputs, onIntermediateResponse, startTime, executeResponse, runId, resolvedWorkflowId, run_status, output_names, runResponse, attempts, runResponse, latestOutputNames, outputPromises, outputResults, successfulOutputs, pendingOutputs, hasErrors, _i, outputResults_1, result, outputData, hasFileContent, hasDownloadUrl, deprecationWarning, legacyResponse, allOutputsResponse, error_1, errorMessage, isIntentionalError;
238
+ return __awaiter(this, arguments, void 0, function (workflowId, data, groupId, pollIntervalMs, timeoutMs, options) {
239
+ var onIntermediateResponse, startTime, executeResponse, runId, resolvedWorkflowId, run_status, output_names, runResponse, attempts, runResponse, latestOutputNames, outputPromises, outputResults, successfulOutputs, pendingOutputs, hasErrors, _i, outputResults_1, result, outputData, hasFileContent, hasDownloadUrl, allOutputsResponse, error_1, errorMessage, isIntentionalError;
240
240
  var _this = this;
241
- var _b, _c, _d, _e, _f, _g, _h, _j;
241
+ var _a, _b, _c, _d, _e, _f, _g, _h;
242
242
  if (pollIntervalMs === void 0) { pollIntervalMs = 2000; }
243
243
  if (timeoutMs === void 0) { timeoutMs = 600000; }
244
- return __generator(this, function (_k) {
245
- switch (_k.label) {
244
+ return __generator(this, function (_j) {
245
+ switch (_j.label) {
246
246
  case 0:
247
247
  // Validate inputs
248
248
  if (!workflowId || typeof workflowId !== 'string' || workflowId.trim() === '') {
@@ -257,15 +257,15 @@ var FlowscaleAPI = /** @class */ (function () {
257
257
  if (timeoutMs <= 0) {
258
258
  throw new Error('Timeout must be greater than 0');
259
259
  }
260
- _a = this.resolveExecuteWorkflowAsyncOptions(returnAllOutputsOrOptions), returnAllOutputs = _a.returnAllOutputs, onIntermediateResponse = _a.onIntermediateResponse;
260
+ onIntermediateResponse = options === null || options === void 0 ? void 0 : options.onIntermediateResponse;
261
261
  startTime = Date.now();
262
262
  return [4 /*yield*/, this.executeWorkflow(workflowId, data, groupId)];
263
263
  case 1:
264
- executeResponse = _k.sent();
265
- if (!((_b = executeResponse === null || executeResponse === void 0 ? void 0 : executeResponse.data) === null || _b === void 0 ? void 0 : _b.run_id)) {
264
+ executeResponse = _j.sent();
265
+ if (!((_a = executeResponse === null || executeResponse === void 0 ? void 0 : executeResponse.data) === null || _a === void 0 ? void 0 : _a.run_id)) {
266
266
  throw new Error('No run ID returned from workflow execution');
267
267
  }
268
- if (!((_c = executeResponse === null || executeResponse === void 0 ? void 0 : executeResponse.data) === null || _c === void 0 ? void 0 : _c.workflow_id)) {
268
+ if (!((_b = executeResponse === null || executeResponse === void 0 ? void 0 : executeResponse.data) === null || _b === void 0 ? void 0 : _b.workflow_id)) {
269
269
  throw new Error('No workflow ID returned from workflow execution');
270
270
  }
271
271
  runId = executeResponse.data.run_id;
@@ -278,10 +278,10 @@ var FlowscaleAPI = /** @class */ (function () {
278
278
  response: executeResponse,
279
279
  })];
280
280
  case 2:
281
- _k.sent();
281
+ _j.sent();
282
282
  run_status = "queued";
283
283
  output_names = [];
284
- _k.label = 3;
284
+ _j.label = 3;
285
285
  case 3:
286
286
  if (!(output_names.length === 0)) return [3 /*break*/, 8];
287
287
  if (Date.now() - startTime > timeoutMs) {
@@ -289,9 +289,9 @@ var FlowscaleAPI = /** @class */ (function () {
289
289
  }
290
290
  return [4 /*yield*/, this.getRun(runId)];
291
291
  case 4:
292
- runResponse = _k.sent();
293
- run_status = ((_d = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _d === void 0 ? void 0 : _d.status) || "queued";
294
- output_names = ((_e = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _e === void 0 ? void 0 : _e.output_names) || [];
292
+ runResponse = _j.sent();
293
+ run_status = ((_c = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _c === void 0 ? void 0 : _c.status) || "queued";
294
+ output_names = ((_d = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _d === void 0 ? void 0 : _d.output_names) || [];
295
295
  return [4 /*yield*/, this.emitExecuteWorkflowAsyncIntermediateResponse(onIntermediateResponse, {
296
296
  type: 'run_status',
297
297
  timestamp: new Date().toISOString(),
@@ -299,19 +299,19 @@ var FlowscaleAPI = /** @class */ (function () {
299
299
  workflow_id: resolvedWorkflowId,
300
300
  run_status: run_status,
301
301
  output_names: output_names,
302
- progress: ((_f = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _f === void 0 ? void 0 : _f.progress) || undefined,
302
+ progress: ((_e = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _e === void 0 ? void 0 : _e.progress) || undefined,
303
303
  response: runResponse,
304
304
  })];
305
305
  case 5:
306
- _k.sent();
306
+ _j.sent();
307
307
  if (run_status === 'failed' || run_status === 'cancelled') {
308
308
  throw new Error("Run ".concat(runId, " failed with status: ").concat(run_status));
309
309
  }
310
310
  if (!(output_names.length === 0)) return [3 /*break*/, 7];
311
311
  return [4 /*yield*/, this.sleep(pollIntervalMs)];
312
312
  case 6:
313
- _k.sent();
314
- _k.label = 7;
313
+ _j.sent();
314
+ _j.label = 7;
315
315
  case 7: return [3 /*break*/, 3];
316
316
  case 8:
317
317
  if (!output_names || output_names.length === 0) {
@@ -319,20 +319,20 @@ var FlowscaleAPI = /** @class */ (function () {
319
319
  }
320
320
  this.logInfo("Found ".concat(output_names.length, " outputs to wait for: ").concat(output_names.join(', ')));
321
321
  attempts = 0;
322
- _k.label = 9;
322
+ _j.label = 9;
323
323
  case 9:
324
- if (!true) return [3 /*break*/, 23];
324
+ if (!true) return [3 /*break*/, 21];
325
325
  if (Date.now() - startTime > timeoutMs) {
326
326
  throw new Error("Workflow execution timed out after ".concat(timeoutMs, "ms"));
327
327
  }
328
- _k.label = 10;
328
+ _j.label = 10;
329
329
  case 10:
330
- _k.trys.push([10, 19, , 22]);
330
+ _j.trys.push([10, 17, , 20]);
331
331
  return [4 /*yield*/, this.getRun(runId)];
332
332
  case 11:
333
- runResponse = _k.sent();
334
- run_status = ((_g = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _g === void 0 ? void 0 : _g.status) || run_status;
335
- latestOutputNames = ((_h = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _h === void 0 ? void 0 : _h.output_names) || [];
333
+ runResponse = _j.sent();
334
+ run_status = ((_f = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _f === void 0 ? void 0 : _f.status) || run_status;
335
+ latestOutputNames = ((_g = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _g === void 0 ? void 0 : _g.output_names) || [];
336
336
  if (latestOutputNames.length > 0) {
337
337
  output_names = latestOutputNames;
338
338
  }
@@ -344,11 +344,11 @@ var FlowscaleAPI = /** @class */ (function () {
344
344
  attempt: attempts,
345
345
  run_status: run_status,
346
346
  output_names: output_names,
347
- progress: ((_j = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _j === void 0 ? void 0 : _j.progress) || undefined,
347
+ progress: ((_h = runResponse === null || runResponse === void 0 ? void 0 : runResponse.data) === null || _h === void 0 ? void 0 : _h.progress) || undefined,
348
348
  response: runResponse,
349
349
  })];
350
350
  case 12:
351
- _k.sent();
351
+ _j.sent();
352
352
  if (run_status === 'failed' || run_status === 'cancelled') {
353
353
  throw new Error("Run ".concat(runId, " failed with status: ").concat(run_status));
354
354
  }
@@ -397,7 +397,7 @@ var FlowscaleAPI = /** @class */ (function () {
397
397
  }); });
398
398
  return [4 /*yield*/, Promise.all(outputPromises)];
399
399
  case 13:
400
- outputResults = _k.sent();
400
+ outputResults = _j.sent();
401
401
  successfulOutputs = [];
402
402
  pendingOutputs = [];
403
403
  hasErrors = false;
@@ -453,41 +453,8 @@ var FlowscaleAPI = /** @class */ (function () {
453
453
  if (hasErrors) {
454
454
  throw new Error('One or more workflow outputs failed');
455
455
  }
456
- if (!(pendingOutputs.length === 0)) return [3 /*break*/, 17];
456
+ if (!(pendingOutputs.length === 0)) return [3 /*break*/, 15];
457
457
  this.logInfo("All ".concat(successfulOutputs.length, " outputs completed successfully"));
458
- if (!(returnAllOutputs === false || (returnAllOutputs === undefined && successfulOutputs.length === 1))) return [3 /*break*/, 15];
459
- deprecationWarning = {
460
- message: successfulOutputs.length > 1
461
- ? 'Single output format is deprecated. This workflow returned multiple outputs but only the first is shown.'
462
- : 'Single output format is deprecated. Please migrate to the new multi-output format.',
463
- migration_guide: 'Use executeWorkflowAsync(workflowId, data, groupId, pollInterval, timeout, true) to get all outputs, or access response.data[0] for the first output.',
464
- removal_version: '2.0.0 (September 1st, 2025)'
465
- };
466
- // Log deprecation warning to console
467
- this.logWarn('DEPRECATION WARNING: executeWorkflowAsync single output format is deprecated and will be removed in v2.0.0 (September 1st, 2025). ' +
468
- 'Use returnAllOutputs: true parameter to get the new format with all outputs.');
469
- legacyResponse = {
470
- status: 'success',
471
- data: {
472
- download_url: successfulOutputs[0].download_url,
473
- file_content: successfulOutputs[0].file_content,
474
- generation_status: successfulOutputs[0].generation_status
475
- },
476
- _deprecation: deprecationWarning
477
- };
478
- return [4 /*yield*/, this.emitExecuteWorkflowAsyncIntermediateResponse(onIntermediateResponse, {
479
- type: 'completed',
480
- timestamp: new Date().toISOString(),
481
- run_id: runId,
482
- workflow_id: resolvedWorkflowId,
483
- output_names: output_names,
484
- completed_outputs: successfulOutputs.map(function (output) { return output.filename; }),
485
- response: legacyResponse,
486
- })];
487
- case 14:
488
- _k.sent();
489
- return [2 /*return*/, legacyResponse];
490
- case 15:
491
458
  allOutputsResponse = {
492
459
  status: 'success',
493
460
  data: successfulOutputs
@@ -501,18 +468,18 @@ var FlowscaleAPI = /** @class */ (function () {
501
468
  completed_outputs: successfulOutputs.map(function (output) { return output.filename; }),
502
469
  response: allOutputsResponse,
503
470
  })];
504
- case 16:
505
- _k.sent();
471
+ case 14:
472
+ _j.sent();
506
473
  return [2 /*return*/, allOutputsResponse];
507
- case 17:
474
+ case 15:
508
475
  // If some outputs are still pending, continue polling
509
476
  this.logDebug("".concat(pendingOutputs.length, " outputs still pending: ").concat(pendingOutputs.join(', ')));
510
477
  return [4 /*yield*/, this.sleep(pollIntervalMs)];
511
- case 18:
512
- _k.sent();
513
- return [3 /*break*/, 22];
514
- case 19:
515
- error_1 = _k.sent();
478
+ case 16:
479
+ _j.sent();
480
+ return [3 /*break*/, 20];
481
+ case 17:
482
+ error_1 = _j.sent();
516
483
  errorMessage = error_1 instanceof Error ? error_1.message : String(error_1);
517
484
  isIntentionalError = errorMessage.includes('failed with status:') ||
518
485
  errorMessage.includes('One or more workflow outputs failed');
@@ -530,22 +497,22 @@ var FlowscaleAPI = /** @class */ (function () {
530
497
  output_names: output_names,
531
498
  error: this.formatUnknownError(error_1),
532
499
  })];
533
- case 20:
534
- _k.sent();
500
+ case 18:
501
+ _j.sent();
535
502
  // After several failures, increase polling interval to avoid excessive requests
536
503
  if (attempts > 5) {
537
504
  pollIntervalMs = Math.min(pollIntervalMs * 1.5, 10000); // Increase interval, max 10s
538
505
  }
539
506
  // Wait before retrying
540
507
  return [4 /*yield*/, this.sleep(pollIntervalMs)];
541
- case 21:
508
+ case 19:
542
509
  // Wait before retrying
543
- _k.sent();
544
- return [3 /*break*/, 22];
545
- case 22:
510
+ _j.sent();
511
+ return [3 /*break*/, 20];
512
+ case 20:
546
513
  attempts++;
547
514
  return [3 /*break*/, 9];
548
- case 23: return [2 /*return*/];
515
+ case 21: return [2 /*return*/];
549
516
  }
550
517
  });
551
518
  });
@@ -685,16 +652,6 @@ var FlowscaleAPI = /** @class */ (function () {
685
652
  done: done,
686
653
  };
687
654
  };
688
- FlowscaleAPI.prototype.resolveExecuteWorkflowAsyncOptions = function (returnAllOutputsOrOptions) {
689
- if (returnAllOutputsOrOptions == null ||
690
- typeof returnAllOutputsOrOptions === 'boolean') {
691
- return { returnAllOutputs: returnAllOutputsOrOptions };
692
- }
693
- return {
694
- returnAllOutputs: returnAllOutputsOrOptions.returnAllOutputs,
695
- onIntermediateResponse: returnAllOutputsOrOptions.onIntermediateResponse,
696
- };
697
- };
698
655
  FlowscaleAPI.prototype.emitExecuteWorkflowAsyncIntermediateResponse = function (callback, update) {
699
656
  return __awaiter(this, void 0, void 0, function () {
700
657
  var error_4;
package/dist/types.d.ts CHANGED
@@ -77,11 +77,10 @@ export interface ExecuteWorkflowAsyncIntermediateResponse {
77
77
  pending_outputs?: string[];
78
78
  completed_outputs?: string[];
79
79
  progress?: RunProgress;
80
- response?: ExecuteWorkflowResponse | RunDetailResponse | GetOutputResponse | GetAllOutputsResponse | LegacyGetOutputResponse | null;
80
+ response?: ExecuteWorkflowResponse | RunDetailResponse | GetOutputResponse | GetAllOutputsResponse | null;
81
81
  error?: string;
82
82
  }
83
83
  export interface ExecuteWorkflowAsyncOptions {
84
- returnAllOutputs?: boolean;
85
84
  onIntermediateResponse?: (update: ExecuteWorkflowAsyncIntermediateResponse) => void | Promise<void>;
86
85
  }
87
86
  export interface RunEventsSSEEvent {
@@ -105,14 +104,6 @@ export interface RunEventsSSEConnection {
105
104
  close: () => void;
106
105
  done: Promise<void>;
107
106
  }
108
- export interface DeprecationWarning {
109
- message: string;
110
- migration_guide: string;
111
- removal_version: string;
112
- }
113
- export interface LegacyGetOutputResponse extends GetOutputResponse {
114
- _deprecation?: DeprecationWarning;
115
- }
116
107
  export interface RunDetail {
117
108
  _id: string;
118
109
  team_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowscale",
3
- "version": "1.3.5",
3
+ "version": "2.0.0",
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",