@upstash/qstash 2.7.11-canary-3 → 2.7.11

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/h3.js CHANGED
@@ -152,39 +152,39 @@ function createError(input) {
152
152
  if (isError(input)) {
153
153
  return input;
154
154
  }
155
- const err2 = new H3Error(input.message ?? input.statusMessage ?? "", {
155
+ const err4 = new H3Error(input.message ?? input.statusMessage ?? "", {
156
156
  cause: input.cause || input
157
157
  });
158
158
  if (hasProp(input, "stack")) {
159
159
  try {
160
- Object.defineProperty(err2, "stack", {
160
+ Object.defineProperty(err4, "stack", {
161
161
  get() {
162
162
  return input.stack;
163
163
  }
164
164
  });
165
165
  } catch {
166
166
  try {
167
- err2.stack = input.stack;
167
+ err4.stack = input.stack;
168
168
  } catch {
169
169
  }
170
170
  }
171
171
  }
172
172
  if (input.data) {
173
- err2.data = input.data;
173
+ err4.data = input.data;
174
174
  }
175
175
  if (input.statusCode) {
176
- err2.statusCode = sanitizeStatusCode(input.statusCode, err2.statusCode);
176
+ err4.statusCode = sanitizeStatusCode(input.statusCode, err4.statusCode);
177
177
  } else if (input.status) {
178
- err2.statusCode = sanitizeStatusCode(input.status, err2.statusCode);
178
+ err4.statusCode = sanitizeStatusCode(input.status, err4.statusCode);
179
179
  }
180
180
  if (input.statusMessage) {
181
- err2.statusMessage = input.statusMessage;
181
+ err4.statusMessage = input.statusMessage;
182
182
  } else if (input.statusText) {
183
- err2.statusMessage = input.statusText;
183
+ err4.statusMessage = input.statusText;
184
184
  }
185
- if (err2.statusMessage) {
186
- const originalMessage = err2.statusMessage;
187
- const sanitizedMessage = sanitizeStatusMessage(err2.statusMessage);
185
+ if (err4.statusMessage) {
186
+ const originalMessage = err4.statusMessage;
187
+ const sanitizedMessage = sanitizeStatusMessage(err4.statusMessage);
188
188
  if (sanitizedMessage !== originalMessage) {
189
189
  console.warn(
190
190
  "[h3] Please prefer using `message` for longer error messages instead of `statusMessage`. In the future, `statusMessage` will be sanitized by default."
@@ -192,12 +192,12 @@ function createError(input) {
192
192
  }
193
193
  }
194
194
  if (input.fatal !== void 0) {
195
- err2.fatal = input.fatal;
195
+ err4.fatal = input.fatal;
196
196
  }
197
197
  if (input.unhandled !== void 0) {
198
- err2.unhandled = input.unhandled;
198
+ err4.unhandled = input.unhandled;
199
199
  }
200
- return err2;
200
+ return err4;
201
201
  }
202
202
  function isError(input) {
203
203
  return input?.constructor?.__h3_error__ === true;
@@ -288,8 +288,8 @@ function readRawBody(event, encoding = "utf8") {
288
288
  const promise = event.node.req[RawBodySymbol] = new Promise(
289
289
  (resolve, reject) => {
290
290
  const bodyData = [];
291
- event.node.req.on("error", (err2) => {
292
- reject(err2);
291
+ event.node.req.on("error", (err4) => {
292
+ reject(err4);
293
293
  }).on("data", (chunk) => {
294
294
  bodyData.push(chunk);
295
295
  }).on("end", () => {
@@ -529,7 +529,7 @@ var QStashWorkflowAbort = class extends Error {
529
529
  stepName;
530
530
  constructor(stepName, stepInfo) {
531
531
  super(
532
- `This is an QStash Workflow error thrown after a step executes. It is expected to be raised. Make sure that you await for each step. Also, if you are using try/catch blocks, you should not wrap context.run/sleep/sleepUntil/call methods with try/catch. Aborting workflow after executing step '${stepName}'.`
532
+ `This is an Upstash Workflow error thrown after a step executes. It is expected to be raised. Make sure that you await for each step. Also, if you are using try/catch blocks, you should not wrap context.run/sleep/sleepUntil/call methods with try/catch. Aborting workflow after executing step '${stepName}'.`
533
533
  );
534
534
  this.name = "QStashWorkflowAbort";
535
535
  this.stepName = stepName;
@@ -785,7 +785,7 @@ var Chat = class _Chat {
785
785
  */
786
786
  // eslint-disable-next-line @typescript-eslint/require-await
787
787
  createThirdParty = async (request) => {
788
- const { baseUrl, token, owner } = request.provider;
788
+ const { baseUrl, token, owner, organization } = request.provider;
789
789
  if (owner === "upstash")
790
790
  throw new Error("Upstash is not 3rd party provider!");
791
791
  delete request.provider;
@@ -799,6 +799,9 @@ var Chat = class _Chat {
799
799
  const headers = {
800
800
  "Content-Type": "application/json",
801
801
  Authorization: `Bearer ${token}`,
802
+ ...organization ? {
803
+ "OpenAI-Organization": organization
804
+ } : {},
802
805
  ...isStream ? {
803
806
  Connection: "keep-alive",
804
807
  Accept: "text/event-stream",
@@ -1014,7 +1017,7 @@ function decodeBase64(base64) {
1014
1017
  return new TextDecoder().decode(intArray);
1015
1018
  } catch (error) {
1016
1019
  console.warn(
1017
- `Upstash Qstash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. Error: ${error}`
1020
+ `Upstash Qstash: Failed while decoding base64 "${base64}". Decoding with atob and returning it instead. ${error}`
1018
1021
  );
1019
1022
  return atob(base64);
1020
1023
  }
@@ -1322,377 +1325,11 @@ var DEFAULT_CONTENT_TYPE = "application/json";
1322
1325
  var NO_CONCURRENCY = 1;
1323
1326
  var DEFAULT_RETRIES = 3;
1324
1327
 
1325
- // node_modules/neverthrow/dist/index.es.js
1326
- var defaultErrorConfig = {
1327
- withStackTrace: false
1328
- };
1329
- var createNeverThrowError = (message, result, config = defaultErrorConfig) => {
1330
- const data = result.isOk() ? { type: "Ok", value: result.value } : { type: "Err", value: result.error };
1331
- const maybeStack = config.withStackTrace ? new Error().stack : void 0;
1332
- return {
1333
- data,
1334
- message,
1335
- stack: maybeStack
1336
- };
1337
- };
1338
- function __awaiter(thisArg, _arguments, P, generator) {
1339
- function adopt(value) {
1340
- return value instanceof P ? value : new P(function(resolve) {
1341
- resolve(value);
1342
- });
1343
- }
1344
- return new (P || (P = Promise))(function(resolve, reject) {
1345
- function fulfilled(value) {
1346
- try {
1347
- step(generator.next(value));
1348
- } catch (e) {
1349
- reject(e);
1350
- }
1351
- }
1352
- function rejected(value) {
1353
- try {
1354
- step(generator["throw"](value));
1355
- } catch (e) {
1356
- reject(e);
1357
- }
1358
- }
1359
- function step(result) {
1360
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1361
- }
1362
- step((generator = generator.apply(thisArg, [])).next());
1363
- });
1364
- }
1365
- function __values(o) {
1366
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1367
- if (m)
1368
- return m.call(o);
1369
- if (o && typeof o.length === "number")
1370
- return {
1371
- next: function() {
1372
- if (o && i >= o.length)
1373
- o = void 0;
1374
- return { value: o && o[i++], done: !o };
1375
- }
1376
- };
1377
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1378
- }
1379
- function __await(v) {
1380
- return this instanceof __await ? (this.v = v, this) : new __await(v);
1381
- }
1382
- function __asyncGenerator(thisArg, _arguments, generator) {
1383
- if (!Symbol.asyncIterator)
1384
- throw new TypeError("Symbol.asyncIterator is not defined.");
1385
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
1386
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
1387
- return this;
1388
- }, i;
1389
- function verb(n) {
1390
- if (g[n])
1391
- i[n] = function(v) {
1392
- return new Promise(function(a, b) {
1393
- q.push([n, v, a, b]) > 1 || resume(n, v);
1394
- });
1395
- };
1396
- }
1397
- function resume(n, v) {
1398
- try {
1399
- step(g[n](v));
1400
- } catch (e) {
1401
- settle(q[0][3], e);
1402
- }
1403
- }
1404
- function step(r) {
1405
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
1406
- }
1407
- function fulfill(value) {
1408
- resume("next", value);
1409
- }
1410
- function reject(value) {
1411
- resume("throw", value);
1412
- }
1413
- function settle(f, v) {
1414
- if (f(v), q.shift(), q.length)
1415
- resume(q[0][0], q[0][1]);
1416
- }
1417
- }
1418
- function __asyncDelegator(o) {
1419
- var i, p;
1420
- return i = {}, verb("next"), verb("throw", function(e) {
1421
- throw e;
1422
- }), verb("return"), i[Symbol.iterator] = function() {
1423
- return this;
1424
- }, i;
1425
- function verb(n, f) {
1426
- i[n] = o[n] ? function(v) {
1427
- return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v;
1428
- } : f;
1429
- }
1430
- }
1431
- function __asyncValues(o) {
1432
- if (!Symbol.asyncIterator)
1433
- throw new TypeError("Symbol.asyncIterator is not defined.");
1434
- var m = o[Symbol.asyncIterator], i;
1435
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
1436
- return this;
1437
- }, i);
1438
- function verb(n) {
1439
- i[n] = o[n] && function(v) {
1440
- return new Promise(function(resolve, reject) {
1441
- v = o[n](v), settle(resolve, reject, v.done, v.value);
1442
- });
1443
- };
1444
- }
1445
- function settle(resolve, reject, d, v) {
1446
- Promise.resolve(v).then(function(v2) {
1447
- resolve({ value: v2, done: d });
1448
- }, reject);
1449
- }
1450
- }
1451
- var ResultAsync = class _ResultAsync {
1452
- constructor(res) {
1453
- this._promise = res;
1454
- }
1455
- static fromSafePromise(promise) {
1456
- const newPromise = promise.then((value) => new Ok(value));
1457
- return new _ResultAsync(newPromise);
1458
- }
1459
- static fromPromise(promise, errorFn) {
1460
- const newPromise = promise.then((value) => new Ok(value)).catch((e) => new Err(errorFn(e)));
1461
- return new _ResultAsync(newPromise);
1462
- }
1463
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1464
- static fromThrowable(fn, errorFn) {
1465
- return (...args) => {
1466
- return new _ResultAsync((() => __awaiter(this, void 0, void 0, function* () {
1467
- try {
1468
- return new Ok(yield fn(...args));
1469
- } catch (error) {
1470
- return new Err(errorFn ? errorFn(error) : error);
1471
- }
1472
- }))());
1473
- };
1474
- }
1475
- static combine(asyncResultList) {
1476
- return combineResultAsyncList(asyncResultList);
1477
- }
1478
- static combineWithAllErrors(asyncResultList) {
1479
- return combineResultAsyncListWithAllErrors(asyncResultList);
1480
- }
1481
- map(f) {
1482
- return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
1483
- if (res.isErr()) {
1484
- return new Err(res.error);
1485
- }
1486
- return new Ok(yield f(res.value));
1487
- })));
1488
- }
1489
- mapErr(f) {
1490
- return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
1491
- if (res.isOk()) {
1492
- return new Ok(res.value);
1493
- }
1494
- return new Err(yield f(res.error));
1495
- })));
1496
- }
1497
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
1498
- andThen(f) {
1499
- return new _ResultAsync(this._promise.then((res) => {
1500
- if (res.isErr()) {
1501
- return new Err(res.error);
1502
- }
1503
- const newValue = f(res.value);
1504
- return newValue instanceof _ResultAsync ? newValue._promise : newValue;
1505
- }));
1506
- }
1507
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
1508
- orElse(f) {
1509
- return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
1510
- if (res.isErr()) {
1511
- return f(res.error);
1512
- }
1513
- return new Ok(res.value);
1514
- })));
1515
- }
1516
- match(ok2, _err) {
1517
- return this._promise.then((res) => res.match(ok2, _err));
1518
- }
1519
- unwrapOr(t) {
1520
- return this._promise.then((res) => res.unwrapOr(t));
1521
- }
1522
- /**
1523
- * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
1524
- */
1525
- safeUnwrap() {
1526
- return __asyncGenerator(this, arguments, function* safeUnwrap_1() {
1527
- return yield __await(yield __await(yield* __asyncDelegator(__asyncValues(yield __await(this._promise.then((res) => res.safeUnwrap()))))));
1528
- });
1529
- }
1530
- // Makes ResultAsync implement PromiseLike<Result>
1531
- then(successCallback, failureCallback) {
1532
- return this._promise.then(successCallback, failureCallback);
1533
- }
1534
- };
1535
- var errAsync = (err2) => new ResultAsync(Promise.resolve(new Err(err2)));
1536
- var fromPromise = ResultAsync.fromPromise;
1537
- var fromSafePromise = ResultAsync.fromSafePromise;
1538
- var fromAsyncThrowable = ResultAsync.fromThrowable;
1539
- var combineResultList = (resultList) => {
1540
- let acc = ok([]);
1541
- for (const result of resultList) {
1542
- if (result.isErr()) {
1543
- acc = err(result.error);
1544
- break;
1545
- } else {
1546
- acc.map((list) => list.push(result.value));
1547
- }
1548
- }
1549
- return acc;
1550
- };
1551
- var combineResultAsyncList = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);
1552
- var combineResultListWithAllErrors = (resultList) => {
1553
- let acc = ok([]);
1554
- for (const result of resultList) {
1555
- if (result.isErr() && acc.isErr()) {
1556
- acc.error.push(result.error);
1557
- } else if (result.isErr() && acc.isOk()) {
1558
- acc = err([result.error]);
1559
- } else if (result.isOk() && acc.isOk()) {
1560
- acc.value.push(result.value);
1561
- }
1562
- }
1563
- return acc;
1564
- };
1565
- var combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);
1566
- var Result;
1567
- (function(Result2) {
1568
- function fromThrowable2(fn, errorFn) {
1569
- return (...args) => {
1570
- try {
1571
- const result = fn(...args);
1572
- return ok(result);
1573
- } catch (e) {
1574
- return err(errorFn ? errorFn(e) : e);
1575
- }
1576
- };
1577
- }
1578
- Result2.fromThrowable = fromThrowable2;
1579
- function combine(resultList) {
1580
- return combineResultList(resultList);
1581
- }
1582
- Result2.combine = combine;
1583
- function combineWithAllErrors(resultList) {
1584
- return combineResultListWithAllErrors(resultList);
1585
- }
1586
- Result2.combineWithAllErrors = combineWithAllErrors;
1587
- })(Result || (Result = {}));
1588
- var ok = (value) => new Ok(value);
1589
- var err = (err2) => new Err(err2);
1590
- var Ok = class {
1591
- constructor(value) {
1592
- this.value = value;
1593
- }
1594
- isOk() {
1595
- return true;
1596
- }
1597
- isErr() {
1598
- return !this.isOk();
1599
- }
1600
- map(f) {
1601
- return ok(f(this.value));
1602
- }
1603
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1604
- mapErr(_f) {
1605
- return ok(this.value);
1606
- }
1607
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
1608
- andThen(f) {
1609
- return f(this.value);
1610
- }
1611
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
1612
- orElse(_f) {
1613
- return ok(this.value);
1614
- }
1615
- asyncAndThen(f) {
1616
- return f(this.value);
1617
- }
1618
- asyncMap(f) {
1619
- return ResultAsync.fromSafePromise(f(this.value));
1620
- }
1621
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1622
- unwrapOr(_v) {
1623
- return this.value;
1624
- }
1625
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1626
- match(ok2, _err) {
1627
- return ok2(this.value);
1628
- }
1629
- safeUnwrap() {
1630
- const value = this.value;
1631
- return function* () {
1632
- return value;
1633
- }();
1634
- }
1635
- _unsafeUnwrap(_) {
1636
- return this.value;
1637
- }
1638
- _unsafeUnwrapErr(config) {
1639
- throw createNeverThrowError("Called `_unsafeUnwrapErr` on an Ok", this, config);
1640
- }
1641
- };
1642
- var Err = class {
1643
- constructor(error) {
1644
- this.error = error;
1645
- }
1646
- isOk() {
1647
- return false;
1648
- }
1649
- isErr() {
1650
- return !this.isOk();
1651
- }
1652
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1653
- map(_f) {
1654
- return err(this.error);
1655
- }
1656
- mapErr(f) {
1657
- return err(f(this.error));
1658
- }
1659
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
1660
- andThen(_f) {
1661
- return err(this.error);
1662
- }
1663
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
1664
- orElse(f) {
1665
- return f(this.error);
1666
- }
1667
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1668
- asyncAndThen(_f) {
1669
- return errAsync(this.error);
1670
- }
1671
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1672
- asyncMap(_f) {
1673
- return errAsync(this.error);
1674
- }
1675
- unwrapOr(v) {
1676
- return v;
1677
- }
1678
- match(_ok, err2) {
1679
- return err2(this.error);
1680
- }
1681
- safeUnwrap() {
1682
- const error = this.error;
1683
- return function* () {
1684
- yield err(error);
1685
- throw new Error("Do not use this generator out of `safeTry`");
1686
- }();
1687
- }
1688
- _unsafeUnwrap(config) {
1689
- throw createNeverThrowError("Called `_unsafeUnwrap` on an Err", this, config);
1690
- }
1691
- _unsafeUnwrapErr(_) {
1692
- return this.error;
1693
- }
1694
- };
1695
- var fromThrowable = Result.fromThrowable;
1328
+ // src/client/workflow/context.ts
1329
+ var import_neverthrow2 = require("neverthrow");
1330
+
1331
+ // src/client/workflow/workflow-requests.ts
1332
+ var import_neverthrow = require("neverthrow");
1696
1333
 
1697
1334
  // src/client/workflow/types.ts
1698
1335
  var StepTypes = ["Initial", "Run", "SleepFor", "SleepUntil", "Call"];
@@ -1720,10 +1357,10 @@ var triggerFirstInvocation = async (workflowContext, retries, debug) => {
1720
1357
  body: workflowContext.requestPayload,
1721
1358
  url: workflowContext.url
1722
1359
  });
1723
- return ok("success");
1360
+ return (0, import_neverthrow.ok)("success");
1724
1361
  } catch (error) {
1725
1362
  const error_ = error;
1726
- return err(error_);
1363
+ return (0, import_neverthrow.err)(error_);
1727
1364
  }
1728
1365
  };
1729
1366
  var triggerRouteFunction = async ({
@@ -1733,10 +1370,10 @@ var triggerRouteFunction = async ({
1733
1370
  try {
1734
1371
  await onStep();
1735
1372
  await onCleanup();
1736
- return ok("workflow-finished");
1373
+ return (0, import_neverthrow.ok)("workflow-finished");
1737
1374
  } catch (error) {
1738
1375
  const error_ = error;
1739
- return error_ instanceof QStashWorkflowAbort ? ok("step-finished") : err(error_);
1376
+ return error_ instanceof QStashWorkflowAbort ? (0, import_neverthrow.ok)("step-finished") : (0, import_neverthrow.err)(error_);
1740
1377
  }
1741
1378
  };
1742
1379
  var triggerWorkflowDelete = async (workflowContext, debug, cancel = false) => {
@@ -1768,13 +1405,13 @@ var handleThirdPartyCallResult = async (request, requestPayload, client, workflo
1768
1405
  if (!(callbackMessage.status >= 200 && callbackMessage.status < 300)) {
1769
1406
  await debug?.log("WARN", "SUBMIT_THIRD_PARTY_RESULT", {
1770
1407
  status: callbackMessage.status,
1771
- body: decodeBase64(callbackMessage.body)
1408
+ body: atob(callbackMessage.body)
1772
1409
  });
1773
1410
  console.warn(
1774
1411
  `Workflow Warning: "context.call" failed with status ${callbackMessage.status} and will retry (if there are retries remaining). Error Message:
1775
- ${decodeBase64(callbackMessage.body)}`
1412
+ ${atob(callbackMessage.body)}`
1776
1413
  );
1777
- return ok("call-will-retry");
1414
+ return (0, import_neverthrow.ok)("call-will-retry");
1778
1415
  }
1779
1416
  const workflowRunId = request.headers.get(WORKFLOW_ID_HEADER);
1780
1417
  const stepIdString = request.headers.get("Upstash-Workflow-StepId");
@@ -1808,7 +1445,7 @@ ${decodeBase64(callbackMessage.body)}`
1808
1445
  stepId: Number(stepIdString),
1809
1446
  stepName,
1810
1447
  stepType,
1811
- out: decodeBase64(callbackMessage.body),
1448
+ out: atob(callbackMessage.body),
1812
1449
  concurrent: Number(concurrentString)
1813
1450
  };
1814
1451
  await debug?.log("SUBMIT", "SUBMIT_THIRD_PARTY_RESULT", {
@@ -1825,13 +1462,13 @@ ${decodeBase64(callbackMessage.body)}`
1825
1462
  await debug?.log("SUBMIT", "SUBMIT_THIRD_PARTY_RESULT", {
1826
1463
  messageId: result.messageId
1827
1464
  });
1828
- return ok("is-call-return");
1465
+ return (0, import_neverthrow.ok)("is-call-return");
1829
1466
  } else {
1830
- return ok("continue-workflow");
1467
+ return (0, import_neverthrow.ok)("continue-workflow");
1831
1468
  }
1832
1469
  } catch (error) {
1833
1470
  const isCallReturn = request.headers.get("Upstash-Workflow-Callback");
1834
- return err(
1471
+ return (0, import_neverthrow.err)(
1835
1472
  new QStashWorkflowError(
1836
1473
  `Error when handling call return (isCallReturn=${isCallReturn}): ${error}`
1837
1474
  )
@@ -2687,11 +2324,11 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
2687
2324
  await routeFunction(disabledContext);
2688
2325
  } catch (error) {
2689
2326
  if (error instanceof QStashWorkflowAbort && error.stepName === this.disabledMessage) {
2690
- return ok("step-found");
2327
+ return (0, import_neverthrow2.ok)("step-found");
2691
2328
  }
2692
- return err(error);
2329
+ return (0, import_neverthrow2.err)(error);
2693
2330
  }
2694
- return ok("run-ended");
2331
+ return (0, import_neverthrow2.ok)("run-ended");
2695
2332
  }
2696
2333
  };
2697
2334
 
@@ -2744,6 +2381,7 @@ var WorkflowLogger = class _WorkflowLogger {
2744
2381
  };
2745
2382
 
2746
2383
  // src/client/workflow/workflow-parser.ts
2384
+ var import_neverthrow3 = require("neverthrow");
2747
2385
  var getPayload = async (request) => {
2748
2386
  try {
2749
2387
  return await request.text();
@@ -2800,7 +2438,7 @@ var checkIfLastOneIsDuplicate = async (steps, debug) => {
2800
2438
  for (let index = 0; index < steps.length - 1; index++) {
2801
2439
  const step = steps[index];
2802
2440
  if (step.stepId === lastStepId && step.targetStep === lastTargetStepId) {
2803
- const message = `QStash Workflow: The step '${step.stepName}' with id '${step.stepId}' has run twice during workflow execution. Rest of the workflow will continue running as usual.`;
2441
+ const message = `Upstash Workflow: The step '${step.stepName}' with id '${step.stepId}' has run twice during workflow execution. Rest of the workflow will continue running as usual.`;
2804
2442
  await debug?.log("WARN", "RESPONSE_DEFAULT", message);
2805
2443
  console.warn(message);
2806
2444
  return true;
@@ -2848,10 +2486,10 @@ var parseRequest = async (requestPayload, isFirstInvocation, debug) => {
2848
2486
  };
2849
2487
  var handleFailure = async (request, requestPayload, qstashClient, initialPayloadParser, failureFunction, debug) => {
2850
2488
  if (request.headers.get(WORKFLOW_FAILURE_HEADER) !== "true") {
2851
- return ok("not-failure-callback");
2489
+ return (0, import_neverthrow3.ok)("not-failure-callback");
2852
2490
  }
2853
2491
  if (!failureFunction) {
2854
- return err(
2492
+ return (0, import_neverthrow3.err)(
2855
2493
  new QStashWorkflowError(
2856
2494
  "Workflow endpoint is called to handle a failure, but a failureFunction is not provided in serve options. Either provide a failureUrl or a failureFunction."
2857
2495
  )
@@ -2881,9 +2519,9 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
2881
2519
  });
2882
2520
  await failureFunction(workflowContext, status, errorPayload.message, header);
2883
2521
  } catch (error) {
2884
- return err(error);
2522
+ return (0, import_neverthrow3.err)(error);
2885
2523
  }
2886
- return ok("is-failure-callback");
2524
+ return (0, import_neverthrow3.ok)("is-failure-callback");
2887
2525
  };
2888
2526
 
2889
2527
  // src/client/workflow/serve.ts
@@ -2945,7 +2583,7 @@ var serve = (routeFunction, options) => {
2945
2583
  }) : initialWorkflowUrl;
2946
2584
  if (workflowUrl !== initialWorkflowUrl) {
2947
2585
  await debug?.log("WARN", "ENDPOINT_START", {
2948
- warning: `QStash Workflow: replacing the base of the url with "${baseUrl}" and using it as workflow endpoint.`,
2586
+ warning: `Upstash Workflow: replacing the base of the url with "${baseUrl}" and using it as workflow endpoint.`,
2949
2587
  originalURL: initialWorkflowUrl,
2950
2588
  updatedURL: workflowUrl
2951
2589
  });
package/h3.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  serve,
3
3
  verifySignatureH3
4
- } from "./chunk-E4S2C5HM.mjs";
4
+ } from "./chunk-IYU467WN.mjs";
5
5
  import "./chunk-CIVGPRQN.mjs";
6
- import "./chunk-KGI26PDH.mjs";
6
+ import "./chunk-Q6E5NF42.mjs";
7
7
  export {
8
8
  serve,
9
9
  verifySignatureH3
package/hono.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Context } from 'hono';
2
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-DkrYCqaq.mjs';
2
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-DEZq0-qk.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type WorkflowBindings = {
@@ -10,7 +10,7 @@ type WorkflowBindings = {
10
10
  UPSTASH_WORKFLOW_URL?: string;
11
11
  };
12
12
  /**
13
- * Serve method to serve a QStash workflow in a Nextjs project
13
+ * Serve method to serve a Upstash Workflow in a Nextjs project
14
14
  *
15
15
  * See for options https://upstash.com/docs/qstash/workflows/basics/serve
16
16
  *
package/hono.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Context } from 'hono';
2
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-DkrYCqaq.js';
2
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-DEZq0-qk.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type WorkflowBindings = {
@@ -10,7 +10,7 @@ type WorkflowBindings = {
10
10
  UPSTASH_WORKFLOW_URL?: string;
11
11
  };
12
12
  /**
13
- * Serve method to serve a QStash workflow in a Nextjs project
13
+ * Serve method to serve a Upstash Workflow in a Nextjs project
14
14
  *
15
15
  * See for options https://upstash.com/docs/qstash/workflows/basics/serve
16
16
  *