@workflow/world-testing 4.0.1-beta.13 → 4.0.1-beta.14

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.
@@ -889,8 +889,8 @@ var require_db_connections = __commonJS({
889
889
  clearTimeout(idleTimeout);
890
890
  idleTimeoutResolve();
891
891
  }
892
- const promise2 = new Promise((resolve) => {
893
- idleTimeoutResolve = resolve;
892
+ const promise2 = new Promise((resolve2) => {
893
+ idleTimeoutResolve = resolve2;
894
894
  });
895
895
  const waitTime = Math.min(getIdleTimeout(dbPool) + 100, maximumDuration - (Date.now() - bootTime));
896
896
  idleTimeout = setTimeout(() => {
@@ -1094,14 +1094,14 @@ var require_ms = __commonJS({
1094
1094
  options = options || {};
1095
1095
  var type = typeof val;
1096
1096
  if (type === "string" && val.length > 0) {
1097
- return parse4(val);
1097
+ return parse5(val);
1098
1098
  }
1099
1099
  else if (type === "number" && isFinite(val)) {
1100
1100
  return options.long ? fmtLong(val) : fmtShort(val);
1101
1101
  }
1102
1102
  throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
1103
1103
  };
1104
- function parse4(str) {
1104
+ function parse5(str) {
1105
1105
  str = String(str);
1106
1106
  if (str.length > 100) {
1107
1107
  return;
@@ -1155,7 +1155,7 @@ var require_ms = __commonJS({
1155
1155
  return void 0;
1156
1156
  }
1157
1157
  }
1158
- __name(parse4, "parse");
1158
+ __name(parse5, "parse");
1159
1159
  function fmtShort(ms2) {
1160
1160
  var msAbs = Math.abs(ms2);
1161
1161
  if (msAbs >= d) {
@@ -1298,13 +1298,13 @@ var require_isexe = __commonJS({
1298
1298
  if (typeof Promise !== "function") {
1299
1299
  throw new TypeError("callback not provided");
1300
1300
  }
1301
- return new Promise(function (resolve, reject) {
1301
+ return new Promise(function (resolve2, reject) {
1302
1302
  isexe(path9, options || {}, function (er, is) {
1303
1303
  if (er) {
1304
1304
  reject(er);
1305
1305
  }
1306
1306
  else {
1307
- resolve(is);
1307
+ resolve2(is);
1308
1308
  }
1309
1309
  });
1310
1310
  });
@@ -1372,28 +1372,28 @@ var require_which = __commonJS({
1372
1372
  if (!opt)
1373
1373
  opt = {};
1374
1374
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
1375
- const found = [];
1376
- const step = /* @__PURE__ */ __name((i2) => new Promise((resolve, reject) => {
1375
+ const found2 = [];
1376
+ const step = /* @__PURE__ */ __name((i2) => new Promise((resolve2, reject) => {
1377
1377
  if (i2 === pathEnv.length)
1378
- return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
1378
+ return opt.all && found2.length ? resolve2(found2) : reject(getNotFoundError(cmd));
1379
1379
  const ppRaw = pathEnv[i2];
1380
1380
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
1381
1381
  const pCmd = path9.join(pathPart, cmd);
1382
1382
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
1383
- resolve(subStep(p, i2, 0));
1383
+ resolve2(subStep(p, i2, 0));
1384
1384
  }), "step");
1385
- const subStep = /* @__PURE__ */ __name((p, i2, ii) => new Promise((resolve, reject) => {
1385
+ const subStep = /* @__PURE__ */ __name((p, i2, ii) => new Promise((resolve2, reject) => {
1386
1386
  if (ii === pathExt.length)
1387
- return resolve(step(i2 + 1));
1387
+ return resolve2(step(i2 + 1));
1388
1388
  const ext = pathExt[ii];
1389
1389
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
1390
1390
  if (!er && is) {
1391
1391
  if (opt.all)
1392
- found.push(p + ext);
1392
+ found2.push(p + ext);
1393
1393
  else
1394
- return resolve(p + ext);
1394
+ return resolve2(p + ext);
1395
1395
  }
1396
- return resolve(subStep(p, i2, ii + 1));
1396
+ return resolve2(subStep(p, i2, ii + 1));
1397
1397
  });
1398
1398
  }), "subStep");
1399
1399
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -1401,7 +1401,7 @@ var require_which = __commonJS({
1401
1401
  var whichSync = /* @__PURE__ */ __name((cmd, opt) => {
1402
1402
  opt = opt || {};
1403
1403
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
1404
- const found = [];
1404
+ const found2 = [];
1405
1405
  for (let i2 = 0; i2 < pathEnv.length; i2++) {
1406
1406
  const ppRaw = pathEnv[i2];
1407
1407
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
@@ -1413,7 +1413,7 @@ var require_which = __commonJS({
1413
1413
  const is = isexe.sync(cur, { pathExt: pathExtExe });
1414
1414
  if (is) {
1415
1415
  if (opt.all)
1416
- found.push(cur);
1416
+ found2.push(cur);
1417
1417
  else
1418
1418
  return cur;
1419
1419
  }
@@ -1422,8 +1422,8 @@ var require_which = __commonJS({
1422
1422
  }
1423
1423
  }
1424
1424
  }
1425
- if (opt.all && found.length)
1426
- return found;
1425
+ if (opt.all && found2.length)
1426
+ return found2;
1427
1427
  if (opt.nothrow)
1428
1428
  return null;
1429
1429
  throw getNotFoundError(cmd);
@@ -1610,7 +1610,7 @@ var require_parse = __commonJS({
1610
1610
  return parsed;
1611
1611
  }
1612
1612
  __name(parseNonShell, "parseNonShell");
1613
- function parse4(command, args, options) {
1613
+ function parse5(command, args, options) {
1614
1614
  if (args && !Array.isArray(args)) {
1615
1615
  options = args;
1616
1616
  args = null;
@@ -1629,8 +1629,8 @@ var require_parse = __commonJS({
1629
1629
  };
1630
1630
  return options.shell ? parsed : parseNonShell(parsed);
1631
1631
  }
1632
- __name(parse4, "parse");
1633
- module2.exports = parse4;
1632
+ __name(parse5, "parse");
1633
+ module2.exports = parse5;
1634
1634
  }
1635
1635
  });
1636
1636
  // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
@@ -1691,17 +1691,17 @@ var require_cross_spawn = __commonJS({
1691
1691
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports2, module2) {
1692
1692
  "use strict";
1693
1693
  var cp = require("child_process");
1694
- var parse4 = require_parse();
1694
+ var parse5 = require_parse();
1695
1695
  var enoent = require_enoent();
1696
1696
  function spawn2(command, args, options) {
1697
- const parsed = parse4(command, args, options);
1697
+ const parsed = parse5(command, args, options);
1698
1698
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
1699
1699
  enoent.hookChildProcess(spawned, parsed);
1700
1700
  return spawned;
1701
1701
  }
1702
1702
  __name(spawn2, "spawn");
1703
1703
  function spawnSync2(command, args, options) {
1704
- const parsed = parse4(command, args, options);
1704
+ const parsed = parse5(command, args, options);
1705
1705
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
1706
1706
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
1707
1707
  return result;
@@ -1710,7 +1710,7 @@ var require_cross_spawn = __commonJS({
1710
1710
  module2.exports = spawn2;
1711
1711
  module2.exports.spawn = spawn2;
1712
1712
  module2.exports.sync = spawnSync2;
1713
- module2.exports._parse = parse4;
1713
+ module2.exports._parse = parse5;
1714
1714
  module2.exports._enoent = enoent;
1715
1715
  }
1716
1716
  });
@@ -2100,7 +2100,7 @@ var require_has_flag = __commonJS({
2100
2100
  var require_supports_color = __commonJS({
2101
2101
  "../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js"(exports2, module2) {
2102
2102
  "use strict";
2103
- var os = require("os");
2103
+ var os2 = require("os");
2104
2104
  var tty3 = require("tty");
2105
2105
  var hasFlag = require_has_flag();
2106
2106
  var { env } = process;
@@ -2160,7 +2160,7 @@ var require_supports_color = __commonJS({
2160
2160
  return min;
2161
2161
  }
2162
2162
  if (process.platform === "win32") {
2163
- const osRelease = os.release().split(".");
2163
+ const osRelease = os2.release().split(".");
2164
2164
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
2165
2165
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
2166
2166
  }
@@ -2179,10 +2179,10 @@ var require_supports_color = __commonJS({
2179
2179
  return 3;
2180
2180
  }
2181
2181
  if ("TERM_PROGRAM" in env) {
2182
- const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
2182
+ const version3 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
2183
2183
  switch (env.TERM_PROGRAM) {
2184
2184
  case "iTerm.app":
2185
- return version2 >= 3 ? 3 : 2;
2185
+ return version3 >= 3 ? 3 : 2;
2186
2186
  case "Apple_Terminal":
2187
2187
  return 2;
2188
2188
  }
@@ -3582,10 +3582,10 @@ var init_ProxyTracer = __esm({
3582
3582
  NOOP_TRACER = new NoopTracer();
3583
3583
  ProxyTracer = /** @class */
3584
3584
  (function () {
3585
- function ProxyTracer2(_provider, name, version2, options) {
3585
+ function ProxyTracer2(_provider, name, version3, options) {
3586
3586
  this._provider = _provider;
3587
3587
  this.name = name;
3588
- this.version = version2;
3588
+ this.version = version3;
3589
3589
  this.options = options;
3590
3590
  }
3591
3591
  __name(ProxyTracer2, "ProxyTracer");
@@ -3640,9 +3640,9 @@ var init_ProxyTracerProvider = __esm({
3640
3640
  function ProxyTracerProvider2() {
3641
3641
  }
3642
3642
  __name(ProxyTracerProvider2, "ProxyTracerProvider");
3643
- ProxyTracerProvider2.prototype.getTracer = function (name, version2, options) {
3643
+ ProxyTracerProvider2.prototype.getTracer = function (name, version3, options) {
3644
3644
  var _a;
3645
- return (_a = this.getDelegateTracer(name, version2, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version2, options);
3645
+ return (_a = this.getDelegateTracer(name, version3, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version3, options);
3646
3646
  };
3647
3647
  ProxyTracerProvider2.prototype.getDelegate = function () {
3648
3648
  var _a;
@@ -3651,9 +3651,9 @@ var init_ProxyTracerProvider = __esm({
3651
3651
  ProxyTracerProvider2.prototype.setDelegate = function (delegate) {
3652
3652
  this._delegate = delegate;
3653
3653
  };
3654
- ProxyTracerProvider2.prototype.getDelegateTracer = function (name, version2, options) {
3654
+ ProxyTracerProvider2.prototype.getDelegateTracer = function (name, version3, options) {
3655
3655
  var _a;
3656
- return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version2, options);
3656
+ return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version3, options);
3657
3657
  };
3658
3658
  return ProxyTracerProvider2;
3659
3659
  })();
@@ -3856,8 +3856,8 @@ var init_metrics = __esm({
3856
3856
  MetricsAPI2.prototype.getMeterProvider = function () {
3857
3857
  return getGlobal(API_NAME3) || NOOP_METER_PROVIDER;
3858
3858
  };
3859
- MetricsAPI2.prototype.getMeter = function (name, version2, options) {
3860
- return this.getMeterProvider().getMeter(name, version2, options);
3859
+ MetricsAPI2.prototype.getMeter = function (name, version3, options) {
3860
+ return this.getMeterProvider().getMeter(name, version3, options);
3861
3861
  };
3862
3862
  MetricsAPI2.prototype.disable = function () {
3863
3863
  unregisterGlobal(API_NAME3, DiagAPI.instance());
@@ -4024,8 +4024,8 @@ var init_trace = __esm({
4024
4024
  TraceAPI2.prototype.getTracerProvider = function () {
4025
4025
  return getGlobal(API_NAME5) || this._proxyTracerProvider;
4026
4026
  };
4027
- TraceAPI2.prototype.getTracer = function (name, version2) {
4028
- return this.getTracerProvider().getTracer(name, version2);
4027
+ TraceAPI2.prototype.getTracer = function (name, version3) {
4028
+ return this.getTracerProvider().getTracer(name, version3);
4029
4029
  };
4030
4030
  TraceAPI2.prototype.disable = function () {
4031
4031
  unregisterGlobal(API_NAME5, DiagAPI.instance());
@@ -5451,16 +5451,16 @@ var require_diagnostics = __commonJS({
5451
5451
  if (undiciDebugLog.enabled || fetchDebuglog.enabled) {
5452
5452
  const debuglog2 = fetchDebuglog.enabled ? fetchDebuglog : undiciDebugLog;
5453
5453
  diagnosticsChannel.channel("undici:client:beforeConnect").subscribe((evt) => {
5454
- const { connectParams: { version: version2, protocol, port, host } } = evt;
5455
- debuglog2("connecting to %s using %s%s", `${host}${port ? `:${port}` : ""}`, protocol, version2);
5454
+ const { connectParams: { version: version3, protocol, port, host } } = evt;
5455
+ debuglog2("connecting to %s using %s%s", `${host}${port ? `:${port}` : ""}`, protocol, version3);
5456
5456
  });
5457
5457
  diagnosticsChannel.channel("undici:client:connected").subscribe((evt) => {
5458
- const { connectParams: { version: version2, protocol, port, host } } = evt;
5459
- debuglog2("connected to %s using %s%s", `${host}${port ? `:${port}` : ""}`, protocol, version2);
5458
+ const { connectParams: { version: version3, protocol, port, host } } = evt;
5459
+ debuglog2("connected to %s using %s%s", `${host}${port ? `:${port}` : ""}`, protocol, version3);
5460
5460
  });
5461
5461
  diagnosticsChannel.channel("undici:client:connectError").subscribe((evt) => {
5462
- const { connectParams: { version: version2, protocol, port, host }, error: error45 } = evt;
5463
- debuglog2("connection to %s using %s%s errored - %s", `${host}${port ? `:${port}` : ""}`, protocol, version2, error45.message);
5462
+ const { connectParams: { version: version3, protocol, port, host }, error: error45 } = evt;
5463
+ debuglog2("connection to %s using %s%s errored - %s", `${host}${port ? `:${port}` : ""}`, protocol, version3, error45.message);
5464
5464
  });
5465
5465
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
5466
5466
  const { request: { method, path: path9, origin } } = evt;
@@ -5484,16 +5484,16 @@ var require_diagnostics = __commonJS({
5484
5484
  if (!isClientSet) {
5485
5485
  const debuglog2 = undiciDebugLog.enabled ? undiciDebugLog : websocketDebuglog;
5486
5486
  diagnosticsChannel.channel("undici:client:beforeConnect").subscribe((evt) => {
5487
- const { connectParams: { version: version2, protocol, port, host } } = evt;
5488
- debuglog2("connecting to %s%s using %s%s", host, port ? `:${port}` : "", protocol, version2);
5487
+ const { connectParams: { version: version3, protocol, port, host } } = evt;
5488
+ debuglog2("connecting to %s%s using %s%s", host, port ? `:${port}` : "", protocol, version3);
5489
5489
  });
5490
5490
  diagnosticsChannel.channel("undici:client:connected").subscribe((evt) => {
5491
- const { connectParams: { version: version2, protocol, port, host } } = evt;
5492
- debuglog2("connected to %s%s using %s%s", host, port ? `:${port}` : "", protocol, version2);
5491
+ const { connectParams: { version: version3, protocol, port, host } } = evt;
5492
+ debuglog2("connected to %s%s using %s%s", host, port ? `:${port}` : "", protocol, version3);
5493
5493
  });
5494
5494
  diagnosticsChannel.channel("undici:client:connectError").subscribe((evt) => {
5495
- const { connectParams: { version: version2, protocol, port, host }, error: error45 } = evt;
5496
- debuglog2("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version2, error45.message);
5495
+ const { connectParams: { version: version3, protocol, port, host }, error: error45 } = evt;
5496
+ debuglog2("connection to %s%s using %s%s errored - %s", host, port ? `:${port}` : "", protocol, version3, error45.message);
5497
5497
  });
5498
5498
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
5499
5499
  const { request: { method, path: path9, origin } } = evt;
@@ -5955,9 +5955,9 @@ var require_dispatcher_base = __commonJS({
5955
5955
  }
5956
5956
  close(callback) {
5957
5957
  if (callback === void 0) {
5958
- return new Promise((resolve, reject) => {
5958
+ return new Promise((resolve2, reject) => {
5959
5959
  this.close((err, data) => {
5960
- return err ? reject(err) : resolve(data);
5960
+ return err ? reject(err) : resolve2(data);
5961
5961
  });
5962
5962
  });
5963
5963
  }
@@ -5996,11 +5996,11 @@ var require_dispatcher_base = __commonJS({
5996
5996
  err = null;
5997
5997
  }
5998
5998
  if (callback === void 0) {
5999
- return new Promise((resolve, reject) => {
5999
+ return new Promise((resolve2, reject) => {
6000
6000
  this.destroy(err, (err2, data) => {
6001
6001
  return err2 ? (
6002
6002
  /* istanbul ignore next: should never error */
6003
- reject(err2)) : resolve(data);
6003
+ reject(err2)) : resolve2(data);
6004
6004
  });
6005
6005
  });
6006
6006
  }
@@ -7527,24 +7527,24 @@ var require_webidl = __commonJS({
7527
7527
  webidl.util.markAsUncloneable = markAsUncloneable || (() => {
7528
7528
  });
7529
7529
  webidl.util.ConvertToInt = function (V, bitLength, signedness, opts) {
7530
- let upperBound;
7531
- let lowerBound;
7530
+ let upperBound2;
7531
+ let lowerBound2;
7532
7532
  if (bitLength === 64) {
7533
- upperBound = Math.pow(2, 53) - 1;
7533
+ upperBound2 = Math.pow(2, 53) - 1;
7534
7534
  if (signedness === "unsigned") {
7535
- lowerBound = 0;
7535
+ lowerBound2 = 0;
7536
7536
  }
7537
7537
  else {
7538
- lowerBound = Math.pow(-2, 53) + 1;
7538
+ lowerBound2 = Math.pow(-2, 53) + 1;
7539
7539
  }
7540
7540
  }
7541
7541
  else if (signedness === "unsigned") {
7542
- lowerBound = 0;
7543
- upperBound = Math.pow(2, bitLength) - 1;
7542
+ lowerBound2 = 0;
7543
+ upperBound2 = Math.pow(2, bitLength) - 1;
7544
7544
  }
7545
7545
  else {
7546
- lowerBound = Math.pow(-2, bitLength) - 1;
7547
- upperBound = Math.pow(2, bitLength - 1) - 1;
7546
+ lowerBound2 = Math.pow(-2, bitLength) - 1;
7547
+ upperBound2 = Math.pow(2, bitLength - 1) - 1;
7548
7548
  }
7549
7549
  let x = Number(V);
7550
7550
  if (x === 0) {
@@ -7558,16 +7558,16 @@ var require_webidl = __commonJS({
7558
7558
  });
7559
7559
  }
7560
7560
  x = webidl.util.IntegerPart(x);
7561
- if (x < lowerBound || x > upperBound) {
7561
+ if (x < lowerBound2 || x > upperBound2) {
7562
7562
  throw webidl.errors.exception({
7563
7563
  header: "Integer conversion",
7564
- message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.`
7564
+ message: `Value must be between ${lowerBound2}-${upperBound2}, got ${x}.`
7565
7565
  });
7566
7566
  }
7567
7567
  return x;
7568
7568
  }
7569
7569
  if (!Number.isNaN(x) && opts?.clamp === true) {
7570
- x = Math.min(Math.max(x, lowerBound), upperBound);
7570
+ x = Math.min(Math.max(x, lowerBound2), upperBound2);
7571
7571
  if (Math.floor(x) % 2 === 0) {
7572
7572
  x = Math.floor(x);
7573
7573
  }
@@ -8299,8 +8299,8 @@ var require_util2 = __commonJS({
8299
8299
  function createDeferredPromise() {
8300
8300
  let res;
8301
8301
  let rej;
8302
- const promise2 = new Promise((resolve, reject) => {
8303
- res = resolve;
8302
+ const promise2 = new Promise((resolve2, reject) => {
8303
+ res = resolve2;
8304
8304
  rej = reject;
8305
8305
  });
8306
8306
  return { promise: promise2, resolve: res, reject: rej };
@@ -9017,9 +9017,9 @@ var require_formdata_parser = __commonJS({
9017
9017
  var filenameBuffer = Buffer.from("; filename");
9018
9018
  var dd = Buffer.from("--");
9019
9019
  var ddcrlf = Buffer.from("--\r\n");
9020
- function isAsciiString(chars) {
9021
- for (let i2 = 0; i2 < chars.length; ++i2) {
9022
- if ((chars.charCodeAt(i2) & ~127) !== 0) {
9020
+ function isAsciiString(chars2) {
9021
+ for (let i2 = 0; i2 < chars2.length; ++i2) {
9022
+ if ((chars2.charCodeAt(i2) & ~127) !== 0) {
9023
9023
  return false;
9024
9024
  }
9025
9025
  }
@@ -10465,13 +10465,13 @@ upgrade: ${upgrade}\r
10465
10465
  }
10466
10466
  }
10467
10467
  __name(onDrain, "onDrain");
10468
- const waitForDrain = /* @__PURE__ */ __name(() => new Promise((resolve, reject) => {
10468
+ const waitForDrain = /* @__PURE__ */ __name(() => new Promise((resolve2, reject) => {
10469
10469
  assert2(callback === null);
10470
10470
  if (socket[kError]) {
10471
10471
  reject(socket[kError]);
10472
10472
  }
10473
10473
  else {
10474
- callback = resolve;
10474
+ callback = resolve2;
10475
10475
  }
10476
10476
  }), "waitForDrain");
10477
10477
  socket.on("close", onDrain).on("drain", onDrain);
@@ -11060,13 +11060,13 @@ var require_client_h2 = __commonJS({
11060
11060
  }
11061
11061
  }
11062
11062
  __name(onDrain, "onDrain");
11063
- const waitForDrain = /* @__PURE__ */ __name(() => new Promise((resolve, reject) => {
11063
+ const waitForDrain = /* @__PURE__ */ __name(() => new Promise((resolve2, reject) => {
11064
11064
  assert2(callback === null);
11065
11065
  if (socket[kError]) {
11066
11066
  reject(socket[kError]);
11067
11067
  }
11068
11068
  else {
11069
- callback = resolve;
11069
+ callback = resolve2;
11070
11070
  }
11071
11071
  }), "waitForDrain");
11072
11072
  h2stream.on("close", onDrain).on("drain", onDrain);
@@ -11492,17 +11492,17 @@ var require_client = __commonJS({
11492
11492
  return this[kNeedDrain] < 2;
11493
11493
  }
11494
11494
  async [kClose]() {
11495
- return new Promise((resolve) => {
11495
+ return new Promise((resolve2) => {
11496
11496
  if (this[kSize]) {
11497
- this[kClosedResolve] = resolve;
11497
+ this[kClosedResolve] = resolve2;
11498
11498
  }
11499
11499
  else {
11500
- resolve(null);
11500
+ resolve2(null);
11501
11501
  }
11502
11502
  });
11503
11503
  }
11504
11504
  async [kDestroy](err) {
11505
- return new Promise((resolve) => {
11505
+ return new Promise((resolve2) => {
11506
11506
  const requests = this[kQueue].splice(this[kPendingIdx]);
11507
11507
  for (let i2 = 0; i2 < requests.length; i2++) {
11508
11508
  const request = requests[i2];
@@ -11513,7 +11513,7 @@ var require_client = __commonJS({
11513
11513
  this[kClosedResolve]();
11514
11514
  this[kClosedResolve] = null;
11515
11515
  }
11516
- resolve(null);
11516
+ resolve2(null);
11517
11517
  }, "callback");
11518
11518
  if (this[kHTTPContext]) {
11519
11519
  this[kHTTPContext].destroy(err, callback);
@@ -11566,7 +11566,7 @@ var require_client = __commonJS({
11566
11566
  });
11567
11567
  }
11568
11568
  try {
11569
- const socket = await new Promise((resolve, reject) => {
11569
+ const socket = await new Promise((resolve2, reject) => {
11570
11570
  client[kConnector]({
11571
11571
  host,
11572
11572
  hostname: hostname3,
@@ -11579,7 +11579,7 @@ var require_client = __commonJS({
11579
11579
  reject(err);
11580
11580
  }
11581
11581
  else {
11582
- resolve(socket2);
11582
+ resolve2(socket2);
11583
11583
  }
11584
11584
  });
11585
11585
  });
@@ -11935,8 +11935,8 @@ var require_pool_base = __commonJS({
11935
11935
  await Promise.all(this[kClients].map((c3) => c3.close()));
11936
11936
  }
11937
11937
  else {
11938
- await new Promise((resolve) => {
11939
- this[kClosedResolve] = resolve;
11938
+ await new Promise((resolve2) => {
11939
+ this[kClosedResolve] = resolve2;
11940
11940
  });
11941
11941
  }
11942
11942
  }
@@ -13108,7 +13108,7 @@ var require_readable = __commonJS({
13108
13108
  if (this._readableState.closeEmitted) {
13109
13109
  return null;
13110
13110
  }
13111
- return await new Promise((resolve, reject) => {
13111
+ return await new Promise((resolve2, reject) => {
13112
13112
  if (this[kContentLength] > limit) {
13113
13113
  this.destroy(new AbortError());
13114
13114
  }
@@ -13122,7 +13122,7 @@ var require_readable = __commonJS({
13122
13122
  reject(signal.reason ?? new AbortError());
13123
13123
  }
13124
13124
  else {
13125
- resolve(null);
13125
+ resolve2(null);
13126
13126
  }
13127
13127
  }).on("error", noop3).on("data", function (chunk) {
13128
13128
  limit -= chunk.length;
@@ -13143,7 +13143,7 @@ var require_readable = __commonJS({
13143
13143
  __name(isUnusable, "isUnusable");
13144
13144
  async function consume(stream, type) {
13145
13145
  assert2(!stream[kConsume]);
13146
- return new Promise((resolve, reject) => {
13146
+ return new Promise((resolve2, reject) => {
13147
13147
  if (isUnusable(stream)) {
13148
13148
  const rState = stream._readableState;
13149
13149
  if (rState.destroyed && rState.closeEmitted === false) {
@@ -13162,7 +13162,7 @@ var require_readable = __commonJS({
13162
13162
  stream[kConsume] = {
13163
13163
  type,
13164
13164
  stream,
13165
- resolve,
13165
+ resolve: resolve2,
13166
13166
  reject,
13167
13167
  length: 0,
13168
13168
  body: []
@@ -13238,22 +13238,22 @@ var require_readable = __commonJS({
13238
13238
  }
13239
13239
  __name(chunksConcat, "chunksConcat");
13240
13240
  function consumeEnd(consume2) {
13241
- const { type, body, resolve, stream, length } = consume2;
13241
+ const { type, body, resolve: resolve2, stream, length } = consume2;
13242
13242
  try {
13243
13243
  if (type === "text") {
13244
- resolve(chunksDecode(body, length));
13244
+ resolve2(chunksDecode(body, length));
13245
13245
  }
13246
13246
  else if (type === "json") {
13247
- resolve(JSON.parse(chunksDecode(body, length)));
13247
+ resolve2(JSON.parse(chunksDecode(body, length)));
13248
13248
  }
13249
13249
  else if (type === "arrayBuffer") {
13250
- resolve(chunksConcat(body, length).buffer);
13250
+ resolve2(chunksConcat(body, length).buffer);
13251
13251
  }
13252
13252
  else if (type === "blob") {
13253
- resolve(new Blob(body, { type: stream[kContentType] }));
13253
+ resolve2(new Blob(body, { type: stream[kContentType] }));
13254
13254
  }
13255
13255
  else if (type === "bytes") {
13256
- resolve(chunksConcat(body, length));
13256
+ resolve2(chunksConcat(body, length));
13257
13257
  }
13258
13258
  consumeFinish(consume2);
13259
13259
  }
@@ -13519,9 +13519,9 @@ var require_api_request = __commonJS({
13519
13519
  };
13520
13520
  function request(opts, callback) {
13521
13521
  if (callback === void 0) {
13522
- return new Promise((resolve, reject) => {
13522
+ return new Promise((resolve2, reject) => {
13523
13523
  request.call(this, opts, (err, data) => {
13524
- return err ? reject(err) : resolve(data);
13524
+ return err ? reject(err) : resolve2(data);
13525
13525
  });
13526
13526
  });
13527
13527
  }
@@ -13751,9 +13751,9 @@ var require_api_stream = __commonJS({
13751
13751
  };
13752
13752
  function stream(opts, factory, callback) {
13753
13753
  if (callback === void 0) {
13754
- return new Promise((resolve, reject) => {
13754
+ return new Promise((resolve2, reject) => {
13755
13755
  stream.call(this, opts, factory, (err, data) => {
13756
- return err ? reject(err) : resolve(data);
13756
+ return err ? reject(err) : resolve2(data);
13757
13757
  });
13758
13758
  });
13759
13759
  }
@@ -14046,9 +14046,9 @@ var require_api_upgrade = __commonJS({
14046
14046
  };
14047
14047
  function upgrade(opts, callback) {
14048
14048
  if (callback === void 0) {
14049
- return new Promise((resolve, reject) => {
14049
+ return new Promise((resolve2, reject) => {
14050
14050
  upgrade.call(this, opts, (err, data) => {
14051
- return err ? reject(err) : resolve(data);
14051
+ return err ? reject(err) : resolve2(data);
14052
14052
  });
14053
14053
  });
14054
14054
  }
@@ -14144,9 +14144,9 @@ var require_api_connect = __commonJS({
14144
14144
  };
14145
14145
  function connect(opts, callback) {
14146
14146
  if (callback === void 0) {
14147
- return new Promise((resolve, reject) => {
14147
+ return new Promise((resolve2, reject) => {
14148
14148
  connect.call(this, opts, (err, data) => {
14149
- return err ? reject(err) : resolve(data);
14149
+ return err ? reject(err) : resolve2(data);
14150
14150
  });
14151
14151
  });
14152
14152
  }
@@ -17932,7 +17932,7 @@ var require_fetch = __commonJS({
17932
17932
  function dispatch({ body }) {
17933
17933
  const url2 = requestCurrentURL(request);
17934
17934
  const agent = fetchParams.controller.dispatcher;
17935
- return new Promise((resolve, reject) => agent.dispatch({
17935
+ return new Promise((resolve2, reject) => agent.dispatch({
17936
17936
  path: url2.pathname + url2.search,
17937
17937
  origin: url2.origin,
17938
17938
  method: request.method,
@@ -18008,7 +18008,7 @@ var require_fetch = __commonJS({
18008
18008
  }
18009
18009
  }
18010
18010
  const onError = this.onError.bind(this);
18011
- resolve({
18011
+ resolve2({
18012
18012
  status,
18013
18013
  statusText,
18014
18014
  headersList,
@@ -18054,7 +18054,7 @@ var require_fetch = __commonJS({
18054
18054
  for (let i2 = 0; i2 < rawHeaders.length; i2 += 2) {
18055
18055
  headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i2]), rawHeaders[i2 + 1].toString("latin1"), true);
18056
18056
  }
18057
- resolve({
18057
+ resolve2({
18058
18058
  status,
18059
18059
  statusText: STATUS_CODES[status],
18060
18060
  headersList,
@@ -18571,7 +18571,7 @@ var require_util4 = __commonJS({
18571
18571
  if (encoding === "failure") {
18572
18572
  encoding = "UTF-8";
18573
18573
  }
18574
- return decode3(bytes, encoding);
18574
+ return decode4(bytes, encoding);
18575
18575
  }
18576
18576
  case "ArrayBuffer": {
18577
18577
  const sequence = combineByteSequences(bytes);
@@ -18589,7 +18589,7 @@ var require_util4 = __commonJS({
18589
18589
  }
18590
18590
  }
18591
18591
  __name(packageData, "packageData");
18592
- function decode3(ioQueue, encoding) {
18592
+ function decode4(ioQueue, encoding) {
18593
18593
  const bytes = combineByteSequences(ioQueue);
18594
18594
  const BOMEncoding = BOMSniffing(bytes);
18595
18595
  let slice = 0;
@@ -18600,7 +18600,7 @@ var require_util4 = __commonJS({
18600
18600
  const sliced = bytes.slice(slice);
18601
18601
  return new TextDecoder(encoding).decode(sliced);
18602
18602
  }
18603
- __name(decode3, "decode");
18603
+ __name(decode4, "decode");
18604
18604
  function BOMSniffing(ioQueue) {
18605
18605
  const [a2, b, c3] = ioQueue;
18606
18606
  if (a2 === 239 && b === 187 && c3 === 191) {
@@ -21707,8 +21707,8 @@ var require_util8 = __commonJS({
21707
21707
  }
21708
21708
  __name(isASCIINumber, "isASCIINumber");
21709
21709
  function delay(ms2) {
21710
- return new Promise((resolve) => {
21711
- setTimeout(resolve, ms2).unref();
21710
+ return new Promise((resolve2) => {
21711
+ setTimeout(resolve2, ms2).unref();
21712
21712
  });
21713
21713
  }
21714
21714
  __name(delay, "delay");
@@ -23623,13 +23623,13 @@ var import_functions3 = __toESM(require_functions(), 1);
23623
23623
  // ../utils/dist/index.js
23624
23624
  var import_ms = __toESM(require_ms(), 1);
23625
23625
  function withResolvers() {
23626
- let resolve;
23626
+ let resolve2;
23627
23627
  let reject;
23628
23628
  const promise2 = new Promise((_resolve, _reject) => {
23629
- resolve = _resolve;
23629
+ resolve2 = _resolve;
23630
23630
  reject = _reject;
23631
23631
  });
23632
- return { promise: promise2, resolve, reject };
23632
+ return { promise: promise2, resolve: resolve2, reject };
23633
23633
  }
23634
23634
  __name(withResolvers, "withResolvers");
23635
23635
  function once(fn) {
@@ -25244,8 +25244,8 @@ var disconnect = /* @__PURE__ */ __name((anyProcess) => {
25244
25244
  // ../../node_modules/.pnpm/execa@9.6.0/node_modules/execa/lib/utils/deferred.js
25245
25245
  var createDeferred = /* @__PURE__ */ __name(() => {
25246
25246
  const methods = {};
25247
- const promise2 = new Promise((resolve, reject) => {
25248
- Object.assign(methods, { resolve, reject });
25247
+ const promise2 = new Promise((resolve2, reject) => {
25248
+ Object.assign(methods, { resolve: resolve2, reject });
25249
25249
  });
25250
25250
  return Object.assign(promise2, methods);
25251
25251
  }, "createDeferred");
@@ -29657,11 +29657,11 @@ var addConcurrentStream = /* @__PURE__ */ __name((concurrentStreams, stream, wai
29657
29657
  const promises = weakMap.get(stream);
29658
29658
  const promise2 = createDeferred();
29659
29659
  promises.push(promise2);
29660
- const resolve = promise2.resolve.bind(promise2);
29661
- return { resolve, promises };
29660
+ const resolve2 = promise2.resolve.bind(promise2);
29661
+ return { resolve: resolve2, promises };
29662
29662
  }, "addConcurrentStream");
29663
- var waitForConcurrentStreams = /* @__PURE__ */ __name(async ({ resolve, promises }, subprocess) => {
29664
- resolve();
29663
+ var waitForConcurrentStreams = /* @__PURE__ */ __name(async ({ resolve: resolve2, promises }, subprocess) => {
29664
+ resolve2();
29665
29665
  const [isSubprocessExit] = await Promise.race([
29666
29666
  Promise.allSettled([true, subprocess]),
29667
29667
  Promise.all([false, ...promises])
@@ -31405,10 +31405,10 @@ function promiseAllObject(promisesObj) {
31405
31405
  }
31406
31406
  __name(promiseAllObject, "promiseAllObject");
31407
31407
  function randomString(length = 10) {
31408
- const chars = "abcdefghijklmnopqrstuvwxyz";
31408
+ const chars2 = "abcdefghijklmnopqrstuvwxyz";
31409
31409
  let str = "";
31410
31410
  for (let i2 = 0; i2 < length; i2++) {
31411
- str += chars[Math.floor(Math.random() * chars.length)];
31411
+ str += chars2[Math.floor(Math.random() * chars2.length)];
31412
31412
  }
31413
31413
  return str;
31414
31414
  }
@@ -32202,10 +32202,10 @@ var nanoid = /^[a-zA-Z0-9_-]{21}$/;
32202
32202
  var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
32203
32203
  var extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
32204
32204
  var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
32205
- var uuid = /* @__PURE__ */ __name((version2) => {
32206
- if (!version2)
32205
+ var uuid = /* @__PURE__ */ __name((version3) => {
32206
+ if (!version3)
32207
32207
  return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
32208
- return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
32208
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version3}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
32209
32209
  }, "uuid");
32210
32210
  var uuid4 = /* @__PURE__ */ uuid(4);
32211
32211
  var uuid6 = /* @__PURE__ */ uuid(6);
@@ -44147,7 +44147,7 @@ async function paginatedFileSystemQuery(config3) {
44147
44147
  });
44148
44148
  const hasMore = validItems.length > limit;
44149
44149
  const items = hasMore ? validItems.slice(0, limit) : validItems;
44150
- const nextCursor = hasMore && items.length > 0 ? createCursor(items[items.length - 1].createdAt, getId?.(items[items.length - 1])) : null;
44150
+ const nextCursor = items.length > 0 ? createCursor(items[items.length - 1].createdAt, getId?.(items[items.length - 1])) : null;
44151
44151
  return {
44152
44152
  data: items,
44153
44153
  cursor: nextCursor,
@@ -44211,6 +44211,100 @@ var getObjectCreatedAt = /* @__PURE__ */ __name((idPrefix) => (filename) => {
44211
44211
  const ulid4 = id.replace(replaceRegex, "");
44212
44212
  return ulidToDate(ulid4);
44213
44213
  }, "getObjectCreatedAt");
44214
+ function createHooksStorage(basedir) {
44215
+ async function findHookByToken(token) {
44216
+ const hooksDir = import_node_path7.default.join(basedir, "hooks");
44217
+ const files = await listJSONFiles(hooksDir);
44218
+ for (const file2 of files) {
44219
+ const hookPath = import_node_path7.default.join(hooksDir, `${file2}.json`);
44220
+ const hook = await readJSON(hookPath, HookSchema);
44221
+ if (hook && hook.token === token) {
44222
+ return hook;
44223
+ }
44224
+ }
44225
+ return null;
44226
+ }
44227
+ __name(findHookByToken, "findHookByToken");
44228
+ async function create(runId, data) {
44229
+ const existingHook = await findHookByToken(data.token);
44230
+ if (existingHook) {
44231
+ throw new Error(`Hook with token ${data.token} already exists for this project`);
44232
+ }
44233
+ const now = /* @__PURE__ */ new Date();
44234
+ const result = {
44235
+ runId,
44236
+ hookId: data.hookId,
44237
+ token: data.token,
44238
+ metadata: data.metadata,
44239
+ ownerId: "embedded-owner",
44240
+ projectId: "embedded-project",
44241
+ environment: "embedded",
44242
+ createdAt: now
44243
+ };
44244
+ const hookPath = import_node_path7.default.join(basedir, "hooks", `${data.hookId}.json`);
44245
+ await writeJSON(hookPath, result);
44246
+ return result;
44247
+ }
44248
+ __name(create, "create");
44249
+ async function get(hookId, params) {
44250
+ const hookPath = import_node_path7.default.join(basedir, "hooks", `${hookId}.json`);
44251
+ const hook = await readJSON(hookPath, HookSchema);
44252
+ if (!hook) {
44253
+ throw new Error(`Hook ${hookId} not found`);
44254
+ }
44255
+ const resolveData = params?.resolveData || DEFAULT_RESOLVE_DATA_OPTION;
44256
+ return filterHookData(hook, resolveData);
44257
+ }
44258
+ __name(get, "get");
44259
+ async function getByToken(token) {
44260
+ const hook = await findHookByToken(token);
44261
+ if (!hook) {
44262
+ throw new Error(`Hook with token ${token} not found`);
44263
+ }
44264
+ return hook;
44265
+ }
44266
+ __name(getByToken, "getByToken");
44267
+ async function list(params) {
44268
+ const hooksDir = import_node_path7.default.join(basedir, "hooks");
44269
+ const resolveData = params.resolveData || DEFAULT_RESOLVE_DATA_OPTION;
44270
+ const result = await paginatedFileSystemQuery({
44271
+ directory: hooksDir,
44272
+ schema: HookSchema,
44273
+ sortOrder: params.pagination?.sortOrder,
44274
+ limit: params.pagination?.limit,
44275
+ cursor: params.pagination?.cursor,
44276
+ filePrefix: void 0,
44277
+ // Hooks don't have ULIDs, so we can't optimize by filename
44278
+ filter: /* @__PURE__ */ __name((hook) => {
44279
+ if (params.runId && hook.runId !== params.runId) {
44280
+ return false;
44281
+ }
44282
+ return true;
44283
+ }, "filter"),
44284
+ getCreatedAt: /* @__PURE__ */ __name(() => {
44285
+ return /* @__PURE__ */ new Date(0);
44286
+ }, "getCreatedAt"),
44287
+ getId: /* @__PURE__ */ __name((hook) => hook.hookId, "getId")
44288
+ });
44289
+ return {
44290
+ ...result,
44291
+ data: result.data.map((hook) => filterHookData(hook, resolveData))
44292
+ };
44293
+ }
44294
+ __name(list, "list");
44295
+ async function dispose(hookId) {
44296
+ const hookPath = import_node_path7.default.join(basedir, "hooks", `${hookId}.json`);
44297
+ const hook = await readJSON(hookPath, HookSchema);
44298
+ if (!hook) {
44299
+ throw new Error(`Hook ${hookId} not found`);
44300
+ }
44301
+ await deleteJSON(hookPath);
44302
+ return hook;
44303
+ }
44304
+ __name(dispose, "dispose");
44305
+ return { create, get, getByToken, list, dispose };
44306
+ }
44307
+ __name(createHooksStorage, "createHooksStorage");
44214
44308
  function createStorage(basedir) {
44215
44309
  return {
44216
44310
  runs: {
@@ -44474,81 +44568,7 @@ function createStorage(basedir) {
44474
44568
  }
44475
44569
  },
44476
44570
  // Hooks
44477
- hooks: {
44478
- async create(runId, data) {
44479
- const now = /* @__PURE__ */ new Date();
44480
- const result = {
44481
- runId,
44482
- hookId: data.hookId,
44483
- token: data.token,
44484
- metadata: data.metadata,
44485
- ownerId: "embedded-owner",
44486
- projectId: "embedded-project",
44487
- environment: "embedded",
44488
- createdAt: now
44489
- };
44490
- const hookPath = import_node_path7.default.join(basedir, "hooks", `${data.hookId}.json`);
44491
- await writeJSON(hookPath, result);
44492
- return result;
44493
- },
44494
- async get(hookId, params) {
44495
- const hookPath = import_node_path7.default.join(basedir, "hooks", `${hookId}.json`);
44496
- const hook = await readJSON(hookPath, HookSchema);
44497
- if (!hook) {
44498
- throw new Error(`Hook ${hookId} not found`);
44499
- }
44500
- const resolveData = params?.resolveData || DEFAULT_RESOLVE_DATA_OPTION;
44501
- return filterHookData(hook, resolveData);
44502
- },
44503
- async getByToken(token) {
44504
- const hooksDir = import_node_path7.default.join(basedir, "hooks");
44505
- const files = await listJSONFiles(hooksDir);
44506
- for (const file2 of files) {
44507
- const hookPath = import_node_path7.default.join(hooksDir, `${file2}.json`);
44508
- const hook = await readJSON(hookPath, HookSchema);
44509
- if (hook && hook.token === token) {
44510
- return hook;
44511
- }
44512
- }
44513
- throw new Error(`Hook with token ${token} not found`);
44514
- },
44515
- async list(params) {
44516
- const hooksDir = import_node_path7.default.join(basedir, "hooks");
44517
- const resolveData = params.resolveData || DEFAULT_RESOLVE_DATA_OPTION;
44518
- const result = await paginatedFileSystemQuery({
44519
- directory: hooksDir,
44520
- schema: HookSchema,
44521
- sortOrder: params.pagination?.sortOrder,
44522
- limit: params.pagination?.limit,
44523
- cursor: params.pagination?.cursor,
44524
- filePrefix: void 0,
44525
- // Hooks don't have ULIDs, so we can't optimize by filename
44526
- filter: /* @__PURE__ */ __name((hook) => {
44527
- if (params.runId && hook.runId !== params.runId) {
44528
- return false;
44529
- }
44530
- return true;
44531
- }, "filter"),
44532
- getCreatedAt: /* @__PURE__ */ __name(() => {
44533
- return /* @__PURE__ */ new Date(0);
44534
- }, "getCreatedAt"),
44535
- getId: /* @__PURE__ */ __name((hook) => hook.hookId, "getId")
44536
- });
44537
- return {
44538
- ...result,
44539
- data: result.data.map((hook) => filterHookData(hook, resolveData))
44540
- };
44541
- },
44542
- async dispose(hookId) {
44543
- const hookPath = import_node_path7.default.join(basedir, "hooks", `${hookId}.json`);
44544
- const hook = await readJSON(hookPath, HookSchema);
44545
- if (!hook) {
44546
- throw new Error(`Hook ${hookId} not found`);
44547
- }
44548
- await deleteJSON(hookPath);
44549
- return hook;
44550
- }
44551
- }
44571
+ hooks: createHooksStorage(basedir)
44552
44572
  };
44553
44573
  }
44554
44574
  __name(createStorage, "createStorage");
@@ -44798,8 +44818,8 @@ var AsyncMessageQueue = class {
44798
44818
  throw this.error;
44799
44819
  return null;
44800
44820
  }
44801
- return new Promise((resolve, reject) => {
44802
- this.waiters.push({ resolve, reject });
44821
+ return new Promise((resolve2, reject) => {
44822
+ this.waiters.push({ resolve: resolve2, reject });
44803
44823
  });
44804
44824
  }
44805
44825
  /**
@@ -45968,8 +45988,8 @@ var ConsumerGroup = class {
45968
45988
  let isRunning = true;
45969
45989
  let resolveLifecycle;
45970
45990
  let timeoutId = null;
45971
- const lifecyclePromise = new Promise((resolve) => {
45972
- resolveLifecycle = resolve;
45991
+ const lifecyclePromise = new Promise((resolve2) => {
45992
+ resolveLifecycle = resolve2;
45973
45993
  });
45974
45994
  const extend2 = /* @__PURE__ */ __name(async () => {
45975
45995
  if (!isRunning) {
@@ -46197,7 +46217,11 @@ async function send(topicName, payload, options) {
46197
46217
  }
46198
46218
  __name(send, "send");
46199
46219
  // ../world-vercel/dist/utils.js
46220
+ var import_node_os4 = __toESM(require("node:os"), 1);
46200
46221
  var import_oidc2 = __toESM(require_dist(), 1);
46222
+ // ../world-vercel/dist/version.js
46223
+ var version2 = "4.0.1-beta.7";
46224
+ // ../world-vercel/dist/utils.js
46201
46225
  var DEFAULT_RESOLVE_DATA_OPTION2 = "all";
46202
46226
  function dateToStringReplacer(_key, value) {
46203
46227
  if (value instanceof Date) {
@@ -46206,6 +46230,9 @@ function dateToStringReplacer(_key, value) {
46206
46230
  return value;
46207
46231
  }
46208
46232
  __name(dateToStringReplacer, "dateToStringReplacer");
46233
+ var getUserAgent = /* @__PURE__ */ __name(() => {
46234
+ return `@workflow/world-vercel/${version2} node-${process.version} ${import_node_os4.default.platform()} (${import_node_os4.default.arch()})`;
46235
+ }, "getUserAgent");
46209
46236
  var getHttpUrl = /* @__PURE__ */ __name((config3) => {
46210
46237
  const projectConfig = config3?.projectConfig;
46211
46238
  const defaultUrl = "https://vercel-workflow.com/api";
@@ -46217,6 +46244,7 @@ var getHttpUrl = /* @__PURE__ */ __name((config3) => {
46217
46244
  var getHeaders = /* @__PURE__ */ __name((config3) => {
46218
46245
  const projectConfig = config3?.projectConfig;
46219
46246
  const headers = new Headers(config3?.headers);
46247
+ headers.set("User-Agent", getUserAgent());
46220
46248
  if (projectConfig) {
46221
46249
  headers.set("x-vercel-environment", projectConfig.environment || "production");
46222
46250
  if (projectConfig.projectId) {
@@ -47903,7 +47931,7 @@ var EventsConsumer = class {
47903
47931
  function createUseStep(ctx) {
47904
47932
  return /* @__PURE__ */ __name(function useStep(stepName) {
47905
47933
  return (...args) => {
47906
- const { promise: promise2, resolve, reject } = withResolvers();
47934
+ const { promise: promise2, resolve: resolve2, reject } = withResolvers();
47907
47935
  const correlationId = `step_${ctx.generateUlid()}`;
47908
47936
  ctx.invocationsQueue.push({
47909
47937
  type: "step",
@@ -47965,7 +47993,7 @@ function createUseStep(ctx) {
47965
47993
  else if (event.eventType === "step_completed") {
47966
47994
  const hydratedResult = hydrateStepReturnValue(event.eventData.result, ctx.globalThis);
47967
47995
  setTimeout(() => {
47968
- resolve(hydratedResult);
47996
+ resolve2(hydratedResult);
47969
47997
  }, 0);
47970
47998
  return EventConsumerResult.Finished;
47971
47999
  }
@@ -47987,7 +48015,7 @@ var import_seedrandom = __toESM(require_seedrandom2(), 1);
47987
48015
  // ../core/dist/vm/uuid.js
47988
48016
  function createRandomUUID(rng) {
47989
48017
  return /* @__PURE__ */ __name(function randomUUID() {
47990
- const chars = "0123456789abcdef";
48018
+ const chars2 = "0123456789abcdef";
47991
48019
  let uuid3 = "";
47992
48020
  for (let i2 = 0; i2 < 36; i2++) {
47993
48021
  if (i2 === 8 || i2 === 13 || i2 === 18 || i2 === 23) {
@@ -47997,10 +48025,10 @@ function createRandomUUID(rng) {
47997
48025
  uuid3 += "4";
47998
48026
  }
47999
48027
  else if (i2 === 19) {
48000
- uuid3 += chars[Math.floor(rng() * 4) + 8];
48028
+ uuid3 += chars2[Math.floor(rng() * 4) + 8];
48001
48029
  }
48002
48030
  else {
48003
- uuid3 += chars[Math.floor(rng() * 16)];
48031
+ uuid3 += chars2[Math.floor(rng() * 16)];
48004
48032
  }
48005
48033
  }
48006
48034
  return uuid3;
@@ -48063,7 +48091,7 @@ function createContext(options) {
48063
48091
  }
48064
48092
  });
48065
48093
  g.process = {
48066
- env: process.env
48094
+ env: Object.freeze({ ...process.env })
48067
48095
  };
48068
48096
  g.Headers = globalThis.Headers;
48069
48097
  g.TextEncoder = globalThis.TextEncoder;
@@ -48171,7 +48199,7 @@ __name(createCreateHook, "createCreateHook");
48171
48199
  // ../core/dist/workflow/sleep.js
48172
48200
  function createSleep(ctx) {
48173
48201
  return /* @__PURE__ */ __name(async function sleepImpl(param) {
48174
- const { promise: promise2, resolve } = withResolvers();
48202
+ const { promise: promise2, resolve: resolve2 } = withResolvers();
48175
48203
  const correlationId = `wait_${ctx.generateUlid()}`;
48176
48204
  const resumeAt = parseDurationToDate(param);
48177
48205
  ctx.invocationsQueue.push({
@@ -48200,7 +48228,7 @@ function createSleep(ctx) {
48200
48228
  ctx.invocationsQueue.splice(index, 1);
48201
48229
  }
48202
48230
  setTimeout(() => {
48203
- resolve();
48231
+ resolve2();
48204
48232
  }, 0);
48205
48233
  return EventConsumerResult.Finished;
48206
48234
  }
@@ -48210,6 +48238,26 @@ function createSleep(ctx) {
48210
48238
  }, "sleepImpl");
48211
48239
  }
48212
48240
  __name(createSleep, "createSleep");
48241
+ // ../core/dist/parse-name.js
48242
+ function parseName(tag, name) {
48243
+ if (typeof name !== "string") {
48244
+ return null;
48245
+ }
48246
+ const [prefix, path9, ...functionNameParts] = name.split("//");
48247
+ if (prefix !== tag || !path9 || functionNameParts.length === 0) {
48248
+ return null;
48249
+ }
48250
+ return {
48251
+ shortName: functionNameParts.at(-1) ?? "",
48252
+ path: path9,
48253
+ functionName: functionNameParts.join("//")
48254
+ };
48255
+ }
48256
+ __name(parseName, "parseName");
48257
+ function parseWorkflowName(name) {
48258
+ return parseName("workflow", name);
48259
+ }
48260
+ __name(parseWorkflowName, "parseWorkflowName");
48213
48261
  // ../core/dist/workflow.js
48214
48262
  async function runWorkflow(workflowCode2, workflowRun, events) {
48215
48263
  return trace2(`WORKFLOW.run ${workflowRun.workflowName}`, async (span) => {
@@ -48600,7 +48648,9 @@ Learn more: https://useworkflow.dev/err/${ERROR_SLUGS.FETCH_IN_WORKFLOW_FUNCTION
48600
48648
  vmGlobalThis.console = globalThis.console;
48601
48649
  const SYMBOL_FOR_REQ_CONTEXT = Symbol.for("@vercel/request-context");
48602
48650
  vmGlobalThis[SYMBOL_FOR_REQ_CONTEXT] = globalThis[SYMBOL_FOR_REQ_CONTEXT];
48603
- const workflowFn = (0, import_node_vm2.runInContext)(`${workflowCode2}; globalThis.__private_workflows?.get(${JSON.stringify(workflowRun.workflowName)})`, context2);
48651
+ const parsedName = parseWorkflowName(workflowRun.workflowName);
48652
+ const filename = parsedName?.path || workflowRun.workflowName;
48653
+ const workflowFn = (0, import_node_vm2.runInContext)(`${workflowCode2}; globalThis.__private_workflows?.get(${JSON.stringify(workflowRun.workflowName)})`, context2, { filename });
48604
48654
  if (typeof workflowFn !== "function") {
48605
48655
  throw new ReferenceError(`Workflow ${JSON.stringify(workflowRun.workflowName)} must be a function, but got "${typeof workflowFn}" instead`);
48606
48656
  }
@@ -48620,6 +48670,557 @@ Learn more: https://useworkflow.dev/err/${ERROR_SLUGS.FETCH_IN_WORKFLOW_FUNCTION
48620
48670
  });
48621
48671
  }
48622
48672
  __name(runWorkflow, "runWorkflow");
48673
+ // ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
48674
+ var comma = ",".charCodeAt(0);
48675
+ var semicolon = ";".charCodeAt(0);
48676
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
48677
+ var intToChar = new Uint8Array(64);
48678
+ var charToInt = new Uint8Array(128);
48679
+ for (let i2 = 0; i2 < chars.length; i2++) {
48680
+ const c3 = chars.charCodeAt(i2);
48681
+ intToChar[i2] = c3;
48682
+ charToInt[c3] = i2;
48683
+ }
48684
+ function decodeInteger(reader, relative) {
48685
+ let value = 0;
48686
+ let shift = 0;
48687
+ let integer2 = 0;
48688
+ do {
48689
+ const c3 = reader.next();
48690
+ integer2 = charToInt[c3];
48691
+ value |= (integer2 & 31) << shift;
48692
+ shift += 5;
48693
+ } while (integer2 & 32);
48694
+ const shouldNegate = value & 1;
48695
+ value >>>= 1;
48696
+ if (shouldNegate) {
48697
+ value = -2147483648 | -value;
48698
+ }
48699
+ return relative + value;
48700
+ }
48701
+ __name(decodeInteger, "decodeInteger");
48702
+ function hasMoreVlq(reader, max) {
48703
+ if (reader.pos >= max)
48704
+ return false;
48705
+ return reader.peek() !== comma;
48706
+ }
48707
+ __name(hasMoreVlq, "hasMoreVlq");
48708
+ var bufLength = 1024 * 16;
48709
+ var StringReader = class {
48710
+ static {
48711
+ __name(this, "StringReader");
48712
+ }
48713
+ constructor(buffer) {
48714
+ this.pos = 0;
48715
+ this.buffer = buffer;
48716
+ }
48717
+ next() {
48718
+ return this.buffer.charCodeAt(this.pos++);
48719
+ }
48720
+ peek() {
48721
+ return this.buffer.charCodeAt(this.pos);
48722
+ }
48723
+ indexOf(char) {
48724
+ const { buffer, pos } = this;
48725
+ const idx = buffer.indexOf(char, pos);
48726
+ return idx === -1 ? buffer.length : idx;
48727
+ }
48728
+ };
48729
+ function decode3(mappings) {
48730
+ const { length } = mappings;
48731
+ const reader = new StringReader(mappings);
48732
+ const decoded = [];
48733
+ let genColumn = 0;
48734
+ let sourcesIndex = 0;
48735
+ let sourceLine = 0;
48736
+ let sourceColumn = 0;
48737
+ let namesIndex = 0;
48738
+ do {
48739
+ const semi = reader.indexOf(";");
48740
+ const line = [];
48741
+ let sorted = true;
48742
+ let lastCol = 0;
48743
+ genColumn = 0;
48744
+ while (reader.pos < semi) {
48745
+ let seg;
48746
+ genColumn = decodeInteger(reader, genColumn);
48747
+ if (genColumn < lastCol)
48748
+ sorted = false;
48749
+ lastCol = genColumn;
48750
+ if (hasMoreVlq(reader, semi)) {
48751
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
48752
+ sourceLine = decodeInteger(reader, sourceLine);
48753
+ sourceColumn = decodeInteger(reader, sourceColumn);
48754
+ if (hasMoreVlq(reader, semi)) {
48755
+ namesIndex = decodeInteger(reader, namesIndex);
48756
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
48757
+ }
48758
+ else {
48759
+ seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
48760
+ }
48761
+ }
48762
+ else {
48763
+ seg = [genColumn];
48764
+ }
48765
+ line.push(seg);
48766
+ reader.pos++;
48767
+ }
48768
+ if (!sorted)
48769
+ sort(line);
48770
+ decoded.push(line);
48771
+ reader.pos = semi + 1;
48772
+ } while (reader.pos <= length);
48773
+ return decoded;
48774
+ }
48775
+ __name(decode3, "decode");
48776
+ function sort(line) {
48777
+ line.sort(sortComparator);
48778
+ }
48779
+ __name(sort, "sort");
48780
+ function sortComparator(a2, b) {
48781
+ return a2[0] - b[0];
48782
+ }
48783
+ __name(sortComparator, "sortComparator");
48784
+ // ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
48785
+ var schemeRegex = /^[\w+.-]+:\/\//;
48786
+ var urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
48787
+ var fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
48788
+ function isAbsoluteUrl(input) {
48789
+ return schemeRegex.test(input);
48790
+ }
48791
+ __name(isAbsoluteUrl, "isAbsoluteUrl");
48792
+ function isSchemeRelativeUrl(input) {
48793
+ return input.startsWith("//");
48794
+ }
48795
+ __name(isSchemeRelativeUrl, "isSchemeRelativeUrl");
48796
+ function isAbsolutePath(input) {
48797
+ return input.startsWith("/");
48798
+ }
48799
+ __name(isAbsolutePath, "isAbsolutePath");
48800
+ function isFileUrl(input) {
48801
+ return input.startsWith("file:");
48802
+ }
48803
+ __name(isFileUrl, "isFileUrl");
48804
+ function isRelative(input) {
48805
+ return /^[.?#]/.test(input);
48806
+ }
48807
+ __name(isRelative, "isRelative");
48808
+ function parseAbsoluteUrl(input) {
48809
+ const match = urlRegex.exec(input);
48810
+ return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
48811
+ }
48812
+ __name(parseAbsoluteUrl, "parseAbsoluteUrl");
48813
+ function parseFileUrl(input) {
48814
+ const match = fileRegex.exec(input);
48815
+ const path9 = match[2];
48816
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path9) ? path9 : "/" + path9, match[3] || "", match[4] || "");
48817
+ }
48818
+ __name(parseFileUrl, "parseFileUrl");
48819
+ function makeUrl(scheme, user, host, port, path9, query, hash2) {
48820
+ return {
48821
+ scheme,
48822
+ user,
48823
+ host,
48824
+ port,
48825
+ path: path9,
48826
+ query,
48827
+ hash: hash2,
48828
+ type: 7
48829
+ };
48830
+ }
48831
+ __name(makeUrl, "makeUrl");
48832
+ function parseUrl(input) {
48833
+ if (isSchemeRelativeUrl(input)) {
48834
+ const url3 = parseAbsoluteUrl("http:" + input);
48835
+ url3.scheme = "";
48836
+ url3.type = 6;
48837
+ return url3;
48838
+ }
48839
+ if (isAbsolutePath(input)) {
48840
+ const url3 = parseAbsoluteUrl("http://foo.com" + input);
48841
+ url3.scheme = "";
48842
+ url3.host = "";
48843
+ url3.type = 5;
48844
+ return url3;
48845
+ }
48846
+ if (isFileUrl(input))
48847
+ return parseFileUrl(input);
48848
+ if (isAbsoluteUrl(input))
48849
+ return parseAbsoluteUrl(input);
48850
+ const url2 = parseAbsoluteUrl("http://foo.com/" + input);
48851
+ url2.scheme = "";
48852
+ url2.host = "";
48853
+ url2.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
48854
+ return url2;
48855
+ }
48856
+ __name(parseUrl, "parseUrl");
48857
+ function stripPathFilename(path9) {
48858
+ if (path9.endsWith("/.."))
48859
+ return path9;
48860
+ const index = path9.lastIndexOf("/");
48861
+ return path9.slice(0, index + 1);
48862
+ }
48863
+ __name(stripPathFilename, "stripPathFilename");
48864
+ function mergePaths(url2, base) {
48865
+ normalizePath(base, base.type);
48866
+ if (url2.path === "/") {
48867
+ url2.path = base.path;
48868
+ }
48869
+ else {
48870
+ url2.path = stripPathFilename(base.path) + url2.path;
48871
+ }
48872
+ }
48873
+ __name(mergePaths, "mergePaths");
48874
+ function normalizePath(url2, type) {
48875
+ const rel = type <= 4;
48876
+ const pieces = url2.path.split("/");
48877
+ let pointer = 1;
48878
+ let positive = 0;
48879
+ let addTrailingSlash = false;
48880
+ for (let i2 = 1; i2 < pieces.length; i2++) {
48881
+ const piece = pieces[i2];
48882
+ if (!piece) {
48883
+ addTrailingSlash = true;
48884
+ continue;
48885
+ }
48886
+ addTrailingSlash = false;
48887
+ if (piece === ".")
48888
+ continue;
48889
+ if (piece === "..") {
48890
+ if (positive) {
48891
+ addTrailingSlash = true;
48892
+ positive--;
48893
+ pointer--;
48894
+ }
48895
+ else if (rel) {
48896
+ pieces[pointer++] = piece;
48897
+ }
48898
+ continue;
48899
+ }
48900
+ pieces[pointer++] = piece;
48901
+ positive++;
48902
+ }
48903
+ let path9 = "";
48904
+ for (let i2 = 1; i2 < pointer; i2++) {
48905
+ path9 += "/" + pieces[i2];
48906
+ }
48907
+ if (!path9 || addTrailingSlash && !path9.endsWith("/..")) {
48908
+ path9 += "/";
48909
+ }
48910
+ url2.path = path9;
48911
+ }
48912
+ __name(normalizePath, "normalizePath");
48913
+ function resolve(input, base) {
48914
+ if (!input && !base)
48915
+ return "";
48916
+ const url2 = parseUrl(input);
48917
+ let inputType = url2.type;
48918
+ if (base && inputType !== 7) {
48919
+ const baseUrl = parseUrl(base);
48920
+ const baseType = baseUrl.type;
48921
+ switch (inputType) {
48922
+ case 1:
48923
+ url2.hash = baseUrl.hash;
48924
+ // fall through
48925
+ case 2:
48926
+ url2.query = baseUrl.query;
48927
+ // fall through
48928
+ case 3:
48929
+ case 4:
48930
+ mergePaths(url2, baseUrl);
48931
+ // fall through
48932
+ case 5:
48933
+ url2.user = baseUrl.user;
48934
+ url2.host = baseUrl.host;
48935
+ url2.port = baseUrl.port;
48936
+ // fall through
48937
+ case 6:
48938
+ url2.scheme = baseUrl.scheme;
48939
+ }
48940
+ if (baseType > inputType)
48941
+ inputType = baseType;
48942
+ }
48943
+ normalizePath(url2, inputType);
48944
+ const queryHash = url2.query + url2.hash;
48945
+ switch (inputType) {
48946
+ // This is impossible, because of the empty checks at the start of the function.
48947
+ // case UrlType.Empty:
48948
+ case 2:
48949
+ case 3:
48950
+ return queryHash;
48951
+ case 4: {
48952
+ const path9 = url2.path.slice(1);
48953
+ if (!path9)
48954
+ return queryHash || ".";
48955
+ if (isRelative(base || input) && !isRelative(path9)) {
48956
+ return "./" + path9 + queryHash;
48957
+ }
48958
+ return path9 + queryHash;
48959
+ }
48960
+ case 5:
48961
+ return url2.path + queryHash;
48962
+ default:
48963
+ return url2.scheme + "//" + url2.user + url2.host + url2.port + url2.path + queryHash;
48964
+ }
48965
+ }
48966
+ __name(resolve, "resolve");
48967
+ // ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
48968
+ function stripFilename(path9) {
48969
+ if (!path9)
48970
+ return "";
48971
+ const index = path9.lastIndexOf("/");
48972
+ return path9.slice(0, index + 1);
48973
+ }
48974
+ __name(stripFilename, "stripFilename");
48975
+ function resolver(mapUrl, sourceRoot) {
48976
+ const from = stripFilename(mapUrl);
48977
+ const prefix = sourceRoot ? sourceRoot + "/" : "";
48978
+ return (source) => resolve(prefix + (source || ""), from);
48979
+ }
48980
+ __name(resolver, "resolver");
48981
+ var COLUMN = 0;
48982
+ var SOURCES_INDEX = 1;
48983
+ var SOURCE_LINE = 2;
48984
+ var SOURCE_COLUMN = 3;
48985
+ var NAMES_INDEX = 4;
48986
+ function maybeSort(mappings, owned) {
48987
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
48988
+ if (unsortedIndex === mappings.length)
48989
+ return mappings;
48990
+ if (!owned)
48991
+ mappings = mappings.slice();
48992
+ for (let i2 = unsortedIndex; i2 < mappings.length; i2 = nextUnsortedSegmentLine(mappings, i2 + 1)) {
48993
+ mappings[i2] = sortSegments(mappings[i2], owned);
48994
+ }
48995
+ return mappings;
48996
+ }
48997
+ __name(maybeSort, "maybeSort");
48998
+ function nextUnsortedSegmentLine(mappings, start2) {
48999
+ for (let i2 = start2; i2 < mappings.length; i2++) {
49000
+ if (!isSorted(mappings[i2]))
49001
+ return i2;
49002
+ }
49003
+ return mappings.length;
49004
+ }
49005
+ __name(nextUnsortedSegmentLine, "nextUnsortedSegmentLine");
49006
+ function isSorted(line) {
49007
+ for (let j = 1; j < line.length; j++) {
49008
+ if (line[j][COLUMN] < line[j - 1][COLUMN]) {
49009
+ return false;
49010
+ }
49011
+ }
49012
+ return true;
49013
+ }
49014
+ __name(isSorted, "isSorted");
49015
+ function sortSegments(line, owned) {
49016
+ if (!owned)
49017
+ line = line.slice();
49018
+ return line.sort(sortComparator2);
49019
+ }
49020
+ __name(sortSegments, "sortSegments");
49021
+ function sortComparator2(a2, b) {
49022
+ return a2[COLUMN] - b[COLUMN];
49023
+ }
49024
+ __name(sortComparator2, "sortComparator");
49025
+ var found = false;
49026
+ function binarySearch(haystack, needle, low, high) {
49027
+ while (low <= high) {
49028
+ const mid = low + (high - low >> 1);
49029
+ const cmp = haystack[mid][COLUMN] - needle;
49030
+ if (cmp === 0) {
49031
+ found = true;
49032
+ return mid;
49033
+ }
49034
+ if (cmp < 0) {
49035
+ low = mid + 1;
49036
+ }
49037
+ else {
49038
+ high = mid - 1;
49039
+ }
49040
+ }
49041
+ found = false;
49042
+ return low - 1;
49043
+ }
49044
+ __name(binarySearch, "binarySearch");
49045
+ function upperBound(haystack, needle, index) {
49046
+ for (let i2 = index + 1; i2 < haystack.length; index = i2++) {
49047
+ if (haystack[i2][COLUMN] !== needle)
49048
+ break;
49049
+ }
49050
+ return index;
49051
+ }
49052
+ __name(upperBound, "upperBound");
49053
+ function lowerBound(haystack, needle, index) {
49054
+ for (let i2 = index - 1; i2 >= 0; index = i2--) {
49055
+ if (haystack[i2][COLUMN] !== needle)
49056
+ break;
49057
+ }
49058
+ return index;
49059
+ }
49060
+ __name(lowerBound, "lowerBound");
49061
+ function memoizedState() {
49062
+ return {
49063
+ lastKey: -1,
49064
+ lastNeedle: -1,
49065
+ lastIndex: -1
49066
+ };
49067
+ }
49068
+ __name(memoizedState, "memoizedState");
49069
+ function memoizedBinarySearch(haystack, needle, state, key) {
49070
+ const { lastKey, lastNeedle, lastIndex } = state;
49071
+ let low = 0;
49072
+ let high = haystack.length - 1;
49073
+ if (key === lastKey) {
49074
+ if (needle === lastNeedle) {
49075
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
49076
+ return lastIndex;
49077
+ }
49078
+ if (needle >= lastNeedle) {
49079
+ low = lastIndex === -1 ? 0 : lastIndex;
49080
+ }
49081
+ else {
49082
+ high = lastIndex;
49083
+ }
49084
+ }
49085
+ state.lastKey = key;
49086
+ state.lastNeedle = needle;
49087
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
49088
+ }
49089
+ __name(memoizedBinarySearch, "memoizedBinarySearch");
49090
+ function parse4(map2) {
49091
+ return typeof map2 === "string" ? JSON.parse(map2) : map2;
49092
+ }
49093
+ __name(parse4, "parse");
49094
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
49095
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
49096
+ var LEAST_UPPER_BOUND = -1;
49097
+ var GREATEST_LOWER_BOUND = 1;
49098
+ var TraceMap = class {
49099
+ static {
49100
+ __name(this, "TraceMap");
49101
+ }
49102
+ constructor(map2, mapUrl) {
49103
+ const isString = typeof map2 === "string";
49104
+ if (!isString && map2._decodedMemo)
49105
+ return map2;
49106
+ const parsed = parse4(map2);
49107
+ const { version: version3, file: file2, names, sourceRoot, sources, sourcesContent } = parsed;
49108
+ this.version = version3;
49109
+ this.file = file2;
49110
+ this.names = names || [];
49111
+ this.sourceRoot = sourceRoot;
49112
+ this.sources = sources;
49113
+ this.sourcesContent = sourcesContent;
49114
+ this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
49115
+ const resolve2 = resolver(mapUrl, sourceRoot);
49116
+ this.resolvedSources = sources.map(resolve2);
49117
+ const { mappings } = parsed;
49118
+ if (typeof mappings === "string") {
49119
+ this._encoded = mappings;
49120
+ this._decoded = void 0;
49121
+ }
49122
+ else if (Array.isArray(mappings)) {
49123
+ this._encoded = void 0;
49124
+ this._decoded = maybeSort(mappings, isString);
49125
+ }
49126
+ else if (parsed.sections) {
49127
+ throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
49128
+ }
49129
+ else {
49130
+ throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
49131
+ }
49132
+ this._decodedMemo = memoizedState();
49133
+ this._bySources = void 0;
49134
+ this._bySourceMemos = void 0;
49135
+ }
49136
+ };
49137
+ function cast(map2) {
49138
+ return map2;
49139
+ }
49140
+ __name(cast, "cast");
49141
+ function decodedMappings(map2) {
49142
+ var _a;
49143
+ return (_a = cast(map2))._decoded || (_a._decoded = decode3(cast(map2)._encoded));
49144
+ }
49145
+ __name(decodedMappings, "decodedMappings");
49146
+ function originalPositionFor(map2, needle) {
49147
+ let { line, column, bias } = needle;
49148
+ line--;
49149
+ if (line < 0)
49150
+ throw new Error(LINE_GTR_ZERO);
49151
+ if (column < 0)
49152
+ throw new Error(COL_GTR_EQ_ZERO);
49153
+ const decoded = decodedMappings(map2);
49154
+ if (line >= decoded.length)
49155
+ return OMapping(null, null, null, null);
49156
+ const segments = decoded[line];
49157
+ const index = traceSegmentInternal(segments, cast(map2)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
49158
+ if (index === -1)
49159
+ return OMapping(null, null, null, null);
49160
+ const segment = segments[index];
49161
+ if (segment.length === 1)
49162
+ return OMapping(null, null, null, null);
49163
+ const { names, resolvedSources } = map2;
49164
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
49165
+ }
49166
+ __name(originalPositionFor, "originalPositionFor");
49167
+ function OMapping(source, line, column, name) {
49168
+ return { source, line, column, name };
49169
+ }
49170
+ __name(OMapping, "OMapping");
49171
+ function traceSegmentInternal(segments, memo, line, column, bias) {
49172
+ let index = memoizedBinarySearch(segments, column, memo, line);
49173
+ if (found) {
49174
+ index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
49175
+ }
49176
+ else if (bias === LEAST_UPPER_BOUND)
49177
+ index++;
49178
+ if (index === -1 || index === segments.length)
49179
+ return -1;
49180
+ return index;
49181
+ }
49182
+ __name(traceSegmentInternal, "traceSegmentInternal");
49183
+ // ../core/dist/source-map.js
49184
+ function remapErrorStack(stack, filename, workflowCode2) {
49185
+ const sourceMapMatch = workflowCode2.match(/\/\/# sourceMappingURL=data:application\/json;base64,(.+)/);
49186
+ if (!sourceMapMatch) {
49187
+ return stack;
49188
+ }
49189
+ try {
49190
+ const base643 = sourceMapMatch[1];
49191
+ const sourceMapJson = Buffer.from(base643, "base64").toString("utf-8");
49192
+ const sourceMapData = JSON.parse(sourceMapJson);
49193
+ const tracer = new TraceMap(sourceMapData);
49194
+ const lines = stack.split("\n");
49195
+ const remappedLines = lines.map((line) => {
49196
+ const frameMatch = line.match(/^\s*at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);
49197
+ if (!frameMatch) {
49198
+ return line;
49199
+ }
49200
+ const [, functionName, file2, lineStr, colStr] = frameMatch;
49201
+ if (!file2.includes(filename)) {
49202
+ return line;
49203
+ }
49204
+ const lineNumber = parseInt(lineStr, 10);
49205
+ const columnNumber = parseInt(colStr, 10);
49206
+ const original = originalPositionFor(tracer, {
49207
+ line: lineNumber,
49208
+ column: columnNumber
49209
+ });
49210
+ if (original.source && original.line !== null) {
49211
+ const func = functionName || original.name || "anonymous";
49212
+ const col = original.column !== null ? original.column : columnNumber;
49213
+ return ` at ${func} (${original.source}:${original.line}:${col})`;
49214
+ }
49215
+ return line;
49216
+ });
49217
+ return remappedLines.join("\n");
49218
+ }
49219
+ catch (e) {
49220
+ return stack;
49221
+ }
49222
+ }
49223
+ __name(remapErrorStack, "remapErrorStack");
48623
49224
  // ../core/dist/runtime/resume-hook.js
48624
49225
  var import_functions = __toESM(require_functions(), 1);
48625
49226
  // ../core/dist/runtime/start.js
@@ -48808,15 +49409,20 @@ function workflowEntrypoint(workflowCode2) {
48808
49409
  }
48809
49410
  else {
48810
49411
  const errorName = getErrorName(err);
48811
- const errorStack = getErrorStack(err);
49412
+ let errorStack = getErrorStack(err);
49413
+ if (errorStack) {
49414
+ const parsedName = parseWorkflowName(workflowName);
49415
+ const filename = parsedName?.path || workflowName;
49416
+ errorStack = remapErrorStack(errorStack, filename, workflowCode2);
49417
+ }
48812
49418
  console.error(`${errorName} while running "${runId}" workflow:
48813
49419
 
48814
49420
  ${errorStack}`);
49421
+ const errorString = errorStack || String(err);
48815
49422
  await world.runs.update(runId, {
48816
49423
  status: "failed",
48817
- error: String(err)
49424
+ error: errorString
48818
49425
  // TODO: include error codes when we define them
48819
- // TODO: serialize/include the error name and stack?
48820
49426
  });
48821
49427
  span?.setAttributes({
48822
49428
  ...WorkflowRunStatus("failed"),
@@ -48838,6 +49444,25 @@ var __export = (target, all) => {
48838
49444
  __defProp(target, name, { get: all[name], enumerable: true });
48839
49445
  };
48840
49446
 
49447
+ // workflows/addition.ts
49448
+ var addition_exports = {};
49449
+ __export(addition_exports, {
49450
+ addition: () => addition
49451
+ });
49452
+ async function add(num, num2) {
49453
+ return globalThis[Symbol.for("WORKFLOW_USE_STEP")]("step//workflows/addition.ts//add")(num, num2);
49454
+ }
49455
+ __name(add, "add");
49456
+ async function addition(num, num2) {
49457
+ const result = await add(num, num2);
49458
+ console.log({
49459
+ result
49460
+ });
49461
+ return result;
49462
+ }
49463
+ __name(addition, "addition");
49464
+ addition.workflowId = "workflow//workflows/addition.ts//addition";
49465
+
48841
49466
  // workflows/noop.ts
48842
49467
  var noop_exports = {};
48843
49468
  __export(noop_exports, {
@@ -48874,29 +49499,11 @@ async function brokenWf() {
48874
49499
  __name(brokenWf, "brokenWf");
48875
49500
  brokenWf.workflowId = "workflow//workflows/noop.ts//brokenWf";
48876
49501
 
48877
- // workflows/addition.ts
48878
- var addition_exports = {};
48879
- __export(addition_exports, {
48880
- addition: () => addition
48881
- });
48882
- async function add(num, num2) {
48883
- return globalThis[Symbol.for("WORKFLOW_USE_STEP")]("step//workflows/addition.ts//add")(num, num2);
48884
- }
48885
- __name(add, "add");
48886
- async function addition(num, num2) {
48887
- const result = await add(num, num2);
48888
- console.log({
48889
- result
48890
- });
48891
- return result;
48892
- }
48893
- __name(addition, "addition");
48894
- addition.workflowId = "workflow//workflows/addition.ts//addition";
48895
-
48896
49502
  // virtual-entry.js
48897
49503
  globalThis.__private_workflows = /* @__PURE__ */ new Map();
48898
- Object.values(noop_exports).map((item) => item?.workflowId && globalThis.__private_workflows.set(item.workflowId, item));
48899
49504
  Object.values(addition_exports).map((item) => item?.workflowId && globalThis.__private_workflows.set(item.workflowId, item));
49505
+ Object.values(noop_exports).map((item) => item?.workflowId && globalThis.__private_workflows.set(item.workflowId, item));
49506
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsid29ya2Zsb3dzL2FkZGl0aW9uLnRzIiwgIndvcmtmbG93cy9ub29wLnRzIiwgInZpcnR1YWwtZW50cnkuanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKl9faW50ZXJuYWxfd29ya2Zsb3dze1wid29ya2Zsb3dzXCI6e1wid29ya2Zsb3dzL2FkZGl0aW9uLnRzXCI6e1wiYWRkaXRpb25cIjp7XCJ3b3JrZmxvd0lkXCI6XCJ3b3JrZmxvdy8vd29ya2Zsb3dzL2FkZGl0aW9uLnRzLy9hZGRpdGlvblwifX19LFwic3RlcHNcIjp7XCJ3b3JrZmxvd3MvYWRkaXRpb24udHNcIjp7XCJhZGRcIjp7XCJzdGVwSWRcIjpcInN0ZXAvL3dvcmtmbG93cy9hZGRpdGlvbi50cy8vYWRkXCJ9fX19Ki87XG5hc3luYyBmdW5jdGlvbiBhZGQobnVtLCBudW0yKSB7XG4gICAgcmV0dXJuIGdsb2JhbFRoaXNbU3ltYm9sLmZvcihcIldPUktGTE9XX1VTRV9TVEVQXCIpXShcInN0ZXAvL3dvcmtmbG93cy9hZGRpdGlvbi50cy8vYWRkXCIpKG51bSwgbnVtMik7XG59XG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gYWRkaXRpb24obnVtLCBudW0yKSB7XG4gICAgY29uc3QgcmVzdWx0ID0gYXdhaXQgYWRkKG51bSwgbnVtMik7XG4gICAgY29uc29sZS5sb2coe1xuICAgICAgICByZXN1bHRcbiAgICB9KTtcbiAgICByZXR1cm4gcmVzdWx0O1xufVxuYWRkaXRpb24ud29ya2Zsb3dJZCA9IFwid29ya2Zsb3cvL3dvcmtmbG93cy9hZGRpdGlvbi50cy8vYWRkaXRpb25cIjtcbiIsICIvKipfX2ludGVybmFsX3dvcmtmbG93c3tcIndvcmtmbG93c1wiOntcIndvcmtmbG93cy9ub29wLnRzXCI6e1wiYnJva2VuV2ZcIjp7XCJ3b3JrZmxvd0lkXCI6XCJ3b3JrZmxvdy8vd29ya2Zsb3dzL25vb3AudHMvL2Jyb2tlbldmXCJ9fX0sXCJzdGVwc1wiOntcIndvcmtmbG93cy9ub29wLnRzXCI6e1wibm9vcFwiOntcInN0ZXBJZFwiOlwic3RlcC8vd29ya2Zsb3dzL25vb3AudHMvL25vb3BcIn19fX0qLztcbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBub29wKF9pKSB7XG4gICAgcmV0dXJuIGdsb2JhbFRoaXNbU3ltYm9sLmZvcihcIldPUktGTE9XX1VTRV9TVEVQXCIpXShcInN0ZXAvL3dvcmtmbG93cy9ub29wLnRzLy9ub29wXCIpKF9pKTtcbn1cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBicm9rZW5XZigpIHtcbiAgICBjb25zdCBudW1iZXJzID0gW107XG4gICAge1xuICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtdO1xuICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgMTA7IGkrKyl7XG4gICAgICAgICAgICBwcm9taXNlcy5wdXNoKG5vb3AoaSkpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnNvbGUubG9nKCdhd2FpdCAxMCcpO1xuICAgICAgICBudW1iZXJzLnB1c2goLi4uYXdhaXQgUHJvbWlzZS5hbGwocHJvbWlzZXMpKTtcbiAgICB9XG4gICAge1xuICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtdO1xuICAgICAgICBmb3IobGV0IGkgPSAwOyBpIDwgMTAwOyBpKyspe1xuICAgICAgICAgICAgcHJvbWlzZXMucHVzaChub29wKDEwMDAgKyBpKSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc29sZS5sb2coJ2F3YWl0IDEwMCcpO1xuICAgICAgICBudW1iZXJzLnB1c2goLi4uYXdhaXQgUHJvbWlzZS5hbGwocHJvbWlzZXMpKTtcbiAgICB9XG4gICAgY29uc29sZS5sb2coJ2RvbmUuJyk7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgbnVtYmVyc1xuICAgIH07XG59XG5icm9rZW5XZi53b3JrZmxvd0lkID0gXCJ3b3JrZmxvdy8vd29ya2Zsb3dzL25vb3AudHMvL2Jyb2tlbldmXCI7XG4iLCAiZ2xvYmFsVGhpcy5fX3ByaXZhdGVfd29ya2Zsb3dzID0gbmV3IE1hcCgpO1xuaW1wb3J0ICogYXMgd29ya2Zsb3dGaWxlMCBmcm9tICcuL3dvcmtmbG93cy9hZGRpdGlvbi50cyc7XG4gICAgICAgICAgICBPYmplY3QudmFsdWVzKHdvcmtmbG93RmlsZTApLm1hcChpdGVtID0+IGl0ZW0/LndvcmtmbG93SWQgJiYgZ2xvYmFsVGhpcy5fX3ByaXZhdGVfd29ya2Zsb3dzLnNldChpdGVtLndvcmtmbG93SWQsIGl0ZW0pKVxuaW1wb3J0ICogYXMgd29ya2Zsb3dGaWxlMSBmcm9tICcuL3dvcmtmbG93cy9ub29wLnRzJztcbiAgICAgICAgICAgIE9iamVjdC52YWx1ZXMod29ya2Zsb3dGaWxlMSkubWFwKGl0ZW0gPT4gaXRlbT8ud29ya2Zsb3dJZCAmJiBnbG9iYWxUaGlzLl9fcHJpdmF0ZV93b3JrZmxvd3Muc2V0KGl0ZW0ud29ya2Zsb3dJZCwgaXRlbSkpIl0sCiAgIm1hcHBpbmdzIjogIjs7Ozs7Ozs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBLGVBQWUsSUFBSSxLQUFLLE1BQU07QUFDMUIsU0FBTyxXQUFXLE9BQU8sSUFBSSxtQkFBbUIsQ0FBQyxFQUFFLGtDQUFrQyxFQUFFLEtBQUssSUFBSTtBQUNwRztBQUZlO0FBR2YsZUFBc0IsU0FBUyxLQUFLLE1BQU07QUFDdEMsUUFBTSxTQUFTLE1BQU0sSUFBSSxLQUFLLElBQUk7QUFDbEMsVUFBUSxJQUFJO0FBQUEsSUFDUjtBQUFBLEVBQ0osQ0FBQztBQUNELFNBQU87QUFDWDtBQU5zQjtBQU90QixTQUFTLGFBQWE7OztBQ1h0QjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0EsZUFBc0IsS0FBSyxJQUFJO0FBQzNCLFNBQU8sV0FBVyxPQUFPLElBQUksbUJBQW1CLENBQUMsRUFBRSwrQkFBK0IsRUFBRSxFQUFFO0FBQzFGO0FBRnNCO0FBR3RCLGVBQXNCLFdBQVc7QUFDN0IsUUFBTSxVQUFVLENBQUM7QUFDakI7QUFDSSxVQUFNLFdBQVcsQ0FBQztBQUNsQixhQUFRLElBQUksR0FBRyxJQUFJLElBQUksS0FBSTtBQUN2QixlQUFTLEtBQUssS0FBSyxDQUFDLENBQUM7QUFBQSxJQUN6QjtBQUNBLFlBQVEsSUFBSSxVQUFVO0FBQ3RCLFlBQVEsS0FBSyxHQUFHLE1BQU0sUUFBUSxJQUFJLFFBQVEsQ0FBQztBQUFBLEVBQy9DO0FBQ0E7QUFDSSxVQUFNLFdBQVcsQ0FBQztBQUNsQixhQUFRLElBQUksR0FBRyxJQUFJLEtBQUssS0FBSTtBQUN4QixlQUFTLEtBQUssS0FBSyxNQUFPLENBQUMsQ0FBQztBQUFBLElBQ2hDO0FBQ0EsWUFBUSxJQUFJLFdBQVc7QUFDdkIsWUFBUSxLQUFLLEdBQUcsTUFBTSxRQUFRLElBQUksUUFBUSxDQUFDO0FBQUEsRUFDL0M7QUFDQSxVQUFRLElBQUksT0FBTztBQUNuQixTQUFPO0FBQUEsSUFDSDtBQUFBLEVBQ0o7QUFDSjtBQXRCc0I7QUF1QnRCLFNBQVMsYUFBYTs7O0FDM0J0QixXQUFXLHNCQUFzQixvQkFBSSxJQUFJO0FBRTdCLE9BQU8sT0FBTyxnQkFBYSxFQUFFLElBQUksVUFBUSxNQUFNLGNBQWMsV0FBVyxvQkFBb0IsSUFBSSxLQUFLLFlBQVksSUFBSSxDQUFDO0FBRXRILE9BQU8sT0FBTyxZQUFhLEVBQUUsSUFBSSxVQUFRLE1BQU0sY0FBYyxXQUFXLG9CQUFvQixJQUFJLEtBQUssWUFBWSxJQUFJLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg==
48900
49507
  `;
48901
49508
  var POST = workflowEntrypoint(workflowCode);
48902
49509
  // Annotate the CommonJS export names for ESM import in node: