@workflow/world-testing 4.1.21 → 4.1.22

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.
@@ -50526,7 +50526,7 @@ init_dist();
50526
50526
  init_node();
50527
50527
 
50528
50528
  // ../core/dist/version.js
50529
- var version2 = "4.8.6";
50529
+ var version2 = "4.8.7";
50530
50530
 
50531
50531
  // ../core/dist/runtime/world.js
50532
50532
  var import_node_module = require("node:module");
@@ -54274,6 +54274,36 @@ var WorkflowHttpTransport = SemanticConvention3("workflow.http.transport");
54274
54274
 
54275
54275
  // ../world-vercel/dist/http-core.js
54276
54276
  var REQUEST_TIMEOUT_MS = 6e4;
54277
+ var TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
54278
+ "UND_ERR_INFO",
54279
+ "UND_ERR_REQ_RETRY",
54280
+ "UND_ERR_SOCKET",
54281
+ "UND_ERR_CONNECT",
54282
+ "UND_ERR_CONNECT_TIMEOUT",
54283
+ "UND_ERR_HEADERS_TIMEOUT",
54284
+ "UND_ERR_BODY_TIMEOUT",
54285
+ "UND_ERR_CLOSED",
54286
+ "ECONNRESET",
54287
+ "ECONNREFUSED",
54288
+ "ENOTFOUND",
54289
+ "EAI_AGAIN",
54290
+ "EPIPE",
54291
+ "ETIMEDOUT"
54292
+ ]);
54293
+ function getTransientTransportCode(error48) {
54294
+ let current = error48;
54295
+ for (let depth = 0; current != null && depth < 8; depth++) {
54296
+ if (typeof current === "object" && "code" in current) {
54297
+ const code = current.code;
54298
+ if (typeof code === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(code)) {
54299
+ return code;
54300
+ }
54301
+ }
54302
+ current = current?.cause;
54303
+ }
54304
+ return void 0;
54305
+ }
54306
+ __name(getTransientTransportCode, "getTransientTransportCode");
54277
54307
  var HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
54278
54308
  var DIAGNOSTIC_HEADERS = [
54279
54309
  "x-vercel-id",
@@ -54414,11 +54444,18 @@ async function instrumentedFetch(opts) {
54414
54444
  const elapsed = Date.now() - start2;
54415
54445
  onTransportOutcome?.(error48);
54416
54446
  if (error48 instanceof Error && (error48.name === "TimeoutError" || error48.name === "AbortError")) {
54417
- const timeoutError = new WorkflowWorldError(`${method} ${label} timed out after ${elapsed}ms`, { url: url2, cause: error48 });
54447
+ const timeoutError = new WorkflowWorldError(`${method} ${label} timed out after ${elapsed}ms`, { url: url2, code: "TIMEOUT", cause: error48 });
54418
54448
  span?.setAttributes({ ...ErrorType2("TIMEOUT") });
54419
54449
  span?.recordException?.(timeoutError);
54420
54450
  throw timeoutError;
54421
54451
  }
54452
+ const transportCode = getTransientTransportCode(error48);
54453
+ if (transportCode) {
54454
+ const transportError2 = new WorkflowWorldError(`${method} ${label} transport failure after ${elapsed}ms (${transportCode})`, { url: url2, code: "TRANSPORT", cause: error48 });
54455
+ span?.setAttributes({ ...ErrorType2("TRANSPORT") });
54456
+ span?.recordException?.(transportError2);
54457
+ throw transportError2;
54458
+ }
54422
54459
  throw error48;
54423
54460
  }
54424
54461
  const ms2 = Date.now() - start2;
@@ -54434,6 +54471,16 @@ async function instrumentedFetch(opts) {
54434
54471
  try {
54435
54472
  error49 = await buildError(response);
54436
54473
  } catch (cause) {
54474
+ const transportCode = getTransientTransportCode(cause);
54475
+ if (transportCode) {
54476
+ if (deferTransportSuccessUntilBody) {
54477
+ onTransportOutcome?.(cause);
54478
+ }
54479
+ const transportError2 = new WorkflowWorldError(`${method} ${label} response body transport failure (${transportCode})`, { url: url2, code: "TRANSPORT", cause });
54480
+ span?.setAttributes({ ...ErrorType2("TRANSPORT") });
54481
+ span?.recordException?.(transportError2);
54482
+ throw transportError2;
54483
+ }
54437
54484
  if (deferTransportSuccessUntilBody) {
54438
54485
  onTransportOutcome?.(cause);
54439
54486
  }
@@ -61591,42 +61638,13 @@ var import_oidc3 = __toESM(require_dist(), 1);
61591
61638
  init_dist();
61592
61639
 
61593
61640
  // ../world-vercel/dist/version.js
61594
- var version3 = "4.7.2";
61641
+ var version3 = "4.7.3";
61595
61642
 
61596
61643
  // ../world-vercel/dist/utils.js
61597
61644
  var WORKFLOW_SERVER_URL_OVERRIDE = "";
61598
61645
  var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
61599
61646
  var MAX_BODY_PARSE_RETRIES = 2;
61600
61647
  var BODY_PARSE_RETRY_BASE_MS = 100;
61601
- var TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
61602
- "UND_ERR_REQ_RETRY",
61603
- "UND_ERR_SOCKET",
61604
- "UND_ERR_CONNECT",
61605
- "UND_ERR_CONNECT_TIMEOUT",
61606
- "UND_ERR_HEADERS_TIMEOUT",
61607
- "UND_ERR_BODY_TIMEOUT",
61608
- "UND_ERR_CLOSED",
61609
- "ECONNRESET",
61610
- "ECONNREFUSED",
61611
- "ENOTFOUND",
61612
- "EAI_AGAIN",
61613
- "EPIPE",
61614
- "ETIMEDOUT"
61615
- ]);
61616
- function getTransientTransportCode(error48) {
61617
- let current = error48;
61618
- for (let depth = 0; current != null && depth < 5; depth++) {
61619
- if (typeof current === "object" && "code" in current) {
61620
- const code = current.code;
61621
- if (typeof code === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(code)) {
61622
- return code;
61623
- }
61624
- }
61625
- current = current?.cause;
61626
- }
61627
- return void 0;
61628
- }
61629
- __name(getTransientTransportCode, "getTransientTransportCode");
61630
61648
  var getWorkflowServerUrlOverride = /* @__PURE__ */ __name(() => WORKFLOW_SERVER_URL_OVERRIDE || process.env.VERCEL_WORKFLOW_SERVER_URL || "", "getWorkflowServerUrlOverride");
61631
61649
  var DEFAULT_RESOLVE_DATA_OPTION2 = "all";
61632
61650
  function deserializeError(obj) {
@@ -62468,7 +62486,8 @@ async function fetchV4(url2, init, config3, opName) {
62468
62486
  }
62469
62487
  } catch (cause) {
62470
62488
  noteEventsTransportOutcome(dispatcher, cause);
62471
- controller.error(cause);
62489
+ const transportCode = getTransientTransportCode(cause);
62490
+ controller.error(transportCode ? new WorkflowWorldError(`v4 ${opName}: response stream transport failure (${transportCode})`, { url: url2, code: "TRANSPORT", cause }) : cause);
62472
62491
  }
62473
62492
  },
62474
62493
  cancel(reason) {
@@ -11,9 +11,17 @@
11
11
  "stepId": "step//./workflows/addition//add"
12
12
  }
13
13
  },
14
- "workflows/null-byte.ts": {
15
- "nullByteStep": {
16
- "stepId": "step//./workflows/null-byte//nullByteStep"
14
+ "workflows/retriable-and-fatal.ts": {
15
+ "stepThatFails": {
16
+ "stepId": "step//./workflows/retriable-and-fatal//stepThatFails"
17
+ },
18
+ "stepThatThrowsRetryableError": {
19
+ "stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
20
+ }
21
+ },
22
+ "workflows/event-limit.ts": {
23
+ "tick": {
24
+ "stepId": "step//./workflows/event-limit//tick"
17
25
  }
18
26
  },
19
27
  "workflows/noop.ts": {
@@ -21,14 +29,14 @@
21
29
  "stepId": "step//./workflows/noop//noop"
22
30
  }
23
31
  },
24
- "workflows/event-limit.ts": {
25
- "tick": {
26
- "stepId": "step//./workflows/event-limit//tick"
32
+ "workflows/null-byte.ts": {
33
+ "nullByteStep": {
34
+ "stepId": "step//./workflows/null-byte//nullByteStep"
27
35
  }
28
36
  },
29
37
  "workflow/dist/stdlib.js": {
30
38
  "fetch": {
31
- "stepId": "step//workflow@4.8.6//fetch"
39
+ "stepId": "step//workflow@4.8.7//fetch"
32
40
  }
33
41
  },
34
42
  "workflow/dist/internal/builtins.js": {
@@ -41,14 +49,6 @@
41
49
  "__builtin_response_text": {
42
50
  "stepId": "__builtin_response_text"
43
51
  }
44
- },
45
- "workflows/retriable-and-fatal.ts": {
46
- "stepThatFails": {
47
- "stepId": "step//./workflows/retriable-and-fatal//stepThatFails"
48
- },
49
- "stepThatThrowsRetryableError": {
50
- "stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
51
- }
52
52
  }
53
53
  },
54
54
  "workflows": {
@@ -173,16 +173,16 @@
173
173
  }
174
174
  }
175
175
  },
176
- "workflows/null-byte.ts": {
177
- "nullByteWorkflow": {
178
- "workflowId": "workflow//./workflows/null-byte//nullByteWorkflow",
176
+ "workflows/retriable-and-fatal.ts": {
177
+ "retryableAndFatalErrorWorkflow": {
178
+ "workflowId": "workflow//./workflows/retriable-and-fatal//retryableAndFatalErrorWorkflow",
179
179
  "graph": {
180
180
  "nodes": [
181
181
  {
182
182
  "id": "start",
183
183
  "type": "workflowStart",
184
184
  "data": {
185
- "label": "Start: nullByteWorkflow",
185
+ "label": "Start: retryableAndFatalErrorWorkflow",
186
186
  "nodeKind": "workflow_start"
187
187
  }
188
188
  },
@@ -190,9 +190,9 @@
190
190
  "id": "node_0",
191
191
  "type": "step",
192
192
  "data": {
193
- "label": "nullByteStep",
193
+ "label": "stepThatThrowsRetryableError",
194
194
  "nodeKind": "step",
195
- "stepId": "step//./workflows/null-byte//nullByteStep"
195
+ "stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
196
196
  }
197
197
  },
198
198
  {
@@ -221,16 +221,16 @@
221
221
  }
222
222
  }
223
223
  },
224
- "workflows/noop.ts": {
225
- "brokenWf": {
226
- "workflowId": "workflow//./workflows/noop//brokenWf",
224
+ "workflows/event-limit.ts": {
225
+ "runawayWorkflow": {
226
+ "workflowId": "workflow//./workflows/event-limit//runawayWorkflow",
227
227
  "graph": {
228
228
  "nodes": [
229
229
  {
230
230
  "id": "start",
231
231
  "type": "workflowStart",
232
232
  "data": {
233
- "label": "Start: brokenWf",
233
+ "label": "Start: runawayWorkflow",
234
234
  "nodeKind": "workflow_start"
235
235
  }
236
236
  },
@@ -238,18 +238,12 @@
238
238
  "id": "node_0",
239
239
  "type": "step",
240
240
  "data": {
241
- "label": "noop",
242
- "nodeKind": "step",
243
- "stepId": "step//./workflows/noop//noop"
244
- }
245
- },
246
- {
247
- "id": "node_1",
248
- "type": "step",
249
- "data": {
250
- "label": "noop",
241
+ "label": "tick",
251
242
  "nodeKind": "step",
252
- "stepId": "step//./workflows/noop//noop"
243
+ "stepId": "step//./workflows/event-limit//tick"
244
+ },
245
+ "metadata": {
246
+ "loopId": "loop_0"
253
247
  }
254
248
  },
255
249
  {
@@ -262,6 +256,12 @@
262
256
  }
263
257
  ],
264
258
  "edges": [
259
+ {
260
+ "id": "e_node_0_back_node_0",
261
+ "source": "node_0",
262
+ "target": "node_0",
263
+ "type": "loop"
264
+ },
265
265
  {
266
266
  "id": "e_start_node_0",
267
267
  "source": "start",
@@ -269,14 +269,8 @@
269
269
  "type": "default"
270
270
  },
271
271
  {
272
- "id": "e_node_0_node_1",
272
+ "id": "e_node_0_end",
273
273
  "source": "node_0",
274
- "target": "node_1",
275
- "type": "default"
276
- },
277
- {
278
- "id": "e_node_1_end",
279
- "source": "node_1",
280
274
  "target": "end",
281
275
  "type": "default"
282
276
  }
@@ -284,16 +278,16 @@
284
278
  }
285
279
  }
286
280
  },
287
- "workflows/event-limit.ts": {
288
- "runawayWorkflow": {
289
- "workflowId": "workflow//./workflows/event-limit//runawayWorkflow",
281
+ "workflows/noop.ts": {
282
+ "brokenWf": {
283
+ "workflowId": "workflow//./workflows/noop//brokenWf",
290
284
  "graph": {
291
285
  "nodes": [
292
286
  {
293
287
  "id": "start",
294
288
  "type": "workflowStart",
295
289
  "data": {
296
- "label": "Start: runawayWorkflow",
290
+ "label": "Start: brokenWf",
297
291
  "nodeKind": "workflow_start"
298
292
  }
299
293
  },
@@ -301,12 +295,18 @@
301
295
  "id": "node_0",
302
296
  "type": "step",
303
297
  "data": {
304
- "label": "tick",
298
+ "label": "noop",
305
299
  "nodeKind": "step",
306
- "stepId": "step//./workflows/event-limit//tick"
307
- },
308
- "metadata": {
309
- "loopId": "loop_0"
300
+ "stepId": "step//./workflows/noop//noop"
301
+ }
302
+ },
303
+ {
304
+ "id": "node_1",
305
+ "type": "step",
306
+ "data": {
307
+ "label": "noop",
308
+ "nodeKind": "step",
309
+ "stepId": "step//./workflows/noop//noop"
310
310
  }
311
311
  },
312
312
  {
@@ -319,12 +319,6 @@
319
319
  }
320
320
  ],
321
321
  "edges": [
322
- {
323
- "id": "e_node_0_back_node_0",
324
- "source": "node_0",
325
- "target": "node_0",
326
- "type": "loop"
327
- },
328
322
  {
329
323
  "id": "e_start_node_0",
330
324
  "source": "start",
@@ -332,8 +326,14 @@
332
326
  "type": "default"
333
327
  },
334
328
  {
335
- "id": "e_node_0_end",
329
+ "id": "e_node_0_node_1",
336
330
  "source": "node_0",
331
+ "target": "node_1",
332
+ "type": "default"
333
+ },
334
+ {
335
+ "id": "e_node_1_end",
336
+ "source": "node_1",
337
337
  "target": "end",
338
338
  "type": "default"
339
339
  }
@@ -341,16 +341,16 @@
341
341
  }
342
342
  }
343
343
  },
344
- "workflows/retriable-and-fatal.ts": {
345
- "retryableAndFatalErrorWorkflow": {
346
- "workflowId": "workflow//./workflows/retriable-and-fatal//retryableAndFatalErrorWorkflow",
344
+ "workflows/null-byte.ts": {
345
+ "nullByteWorkflow": {
346
+ "workflowId": "workflow//./workflows/null-byte//nullByteWorkflow",
347
347
  "graph": {
348
348
  "nodes": [
349
349
  {
350
350
  "id": "start",
351
351
  "type": "workflowStart",
352
352
  "data": {
353
- "label": "Start: retryableAndFatalErrorWorkflow",
353
+ "label": "Start: nullByteWorkflow",
354
354
  "nodeKind": "workflow_start"
355
355
  }
356
356
  },
@@ -358,9 +358,9 @@
358
358
  "id": "node_0",
359
359
  "type": "step",
360
360
  "data": {
361
- "label": "stepThatThrowsRetryableError",
361
+ "label": "nullByteStep",
362
362
  "nodeKind": "step",
363
- "stepId": "step//./workflows/retriable-and-fatal//stepThatThrowsRetryableError"
363
+ "stepId": "step//./workflows/null-byte//nullByteStep"
364
364
  }
365
365
  },
366
366
  {