@upstash/qstash 2.7.0-workflow-alpha.2 → 2.7.0-workflow-alpha.3

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.
@@ -158,20 +158,20 @@ var QstashDailyRatelimitError = class extends QstashError {
158
158
  this.name = "QstashChatRatelimitError";
159
159
  }
160
160
  };
161
- var QstashWorkflowError = class extends QstashError {
161
+ var QStashWorkflowError = class extends QstashError {
162
162
  constructor(message) {
163
163
  super(message);
164
- this.name = "QstashWorkflowError";
164
+ this.name = "QStashWorkflowError";
165
165
  }
166
166
  };
167
- var QstashWorkflowAbort = class extends Error {
167
+ var QStashWorkflowAbort = class extends Error {
168
168
  stepInfo;
169
169
  stepName;
170
170
  constructor(stepName, stepInfo) {
171
171
  super(
172
172
  `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}'.`
173
173
  );
174
- this.name = "QstashWorkflowAbort";
174
+ this.name = "QStashWorkflowAbort";
175
175
  this.stepName = stepName;
176
176
  this.stepInfo = stepInfo;
177
177
  }
@@ -1561,7 +1561,7 @@ var triggerRouteFunction = async ({
1561
1561
  return ok("workflow-finished");
1562
1562
  } catch (error) {
1563
1563
  const error_ = error;
1564
- return error_ instanceof QstashWorkflowAbort ? ok("step-finished") : err(error_);
1564
+ return error_ instanceof QStashWorkflowAbort ? ok("step-finished") : err(error_);
1565
1565
  }
1566
1566
  };
1567
1567
  var triggerWorkflowDelete = async (workflowContext, debug, cancel = false) => {
@@ -1649,7 +1649,7 @@ var handleThirdPartyCallResult = async (request, requestPayload, client, workflo
1649
1649
  } catch (error) {
1650
1650
  const isCallReturn = request.headers.get("Upstash-Workflow-Callback");
1651
1651
  return err(
1652
- new QstashWorkflowError(
1652
+ new QStashWorkflowError(
1653
1653
  `Error when handling call return (isCallReturn=${isCallReturn}): ${error}`
1654
1654
  )
1655
1655
  );
@@ -1717,7 +1717,7 @@ var verifyRequest = async (body, signature, verifier) => {
1717
1717
  throw new Error("Signature in `Upstash-Signature` header is not valid");
1718
1718
  }
1719
1719
  } catch (error) {
1720
- throw new QstashWorkflowError(
1720
+ throw new QStashWorkflowError(
1721
1721
  `Failed to verify that the Workflow request comes from QStash: ${error}
1722
1722
 
1723
1723
  If signature is missing, trigger the workflow endpoint by publishing your request to QStash instead of calling it directly.
@@ -1757,14 +1757,14 @@ var AutoExecutor = class _AutoExecutor {
1757
1757
  *
1758
1758
  * If a function is already executing (this.executingStep), this
1759
1759
  * means that there is a nested step which is not allowed. In this
1760
- * case, addStep throws QstashWorkflowError.
1760
+ * case, addStep throws QStashWorkflowError.
1761
1761
  *
1762
1762
  * @param stepInfo step plan to add
1763
1763
  * @returns result of the step function
1764
1764
  */
1765
1765
  async addStep(stepInfo) {
1766
1766
  if (this.executingStep) {
1767
- throw new QstashWorkflowError(
1767
+ throw new QStashWorkflowError(
1768
1768
  `A step can not be run inside another step. Tried to run '${stepInfo.stepName}' inside '${this.executingStep}'`
1769
1769
  );
1770
1770
  }
@@ -1833,7 +1833,7 @@ var AutoExecutor = class _AutoExecutor {
1833
1833
  step: resultStep,
1834
1834
  stepCount: this.stepCount
1835
1835
  });
1836
- await this.submitStepsToQstash([resultStep]);
1836
+ await this.submitStepsToQStash([resultStep]);
1837
1837
  return resultStep.out;
1838
1838
  }
1839
1839
  /**
@@ -1849,7 +1849,7 @@ var AutoExecutor = class _AutoExecutor {
1849
1849
  const sortedSteps = sortSteps(this.steps);
1850
1850
  const plannedParallelStepCount = sortedSteps[initialStepCount + this.planStepCount]?.concurrent;
1851
1851
  if (parallelCallState !== "first" && plannedParallelStepCount !== parallelSteps.length) {
1852
- throw new QstashWorkflowError(
1852
+ throw new QStashWorkflowError(
1853
1853
  `Incompatible number of parallel steps when call state was '${parallelCallState}'. Expected ${parallelSteps.length}, got ${plannedParallelStepCount} from the request.`
1854
1854
  );
1855
1855
  }
@@ -1865,13 +1865,13 @@ var AutoExecutor = class _AutoExecutor {
1865
1865
  const planSteps = parallelSteps.map(
1866
1866
  (parallelStep, index) => parallelStep.getPlanStep(parallelSteps.length, initialStepCount + index)
1867
1867
  );
1868
- await this.submitStepsToQstash(planSteps);
1868
+ await this.submitStepsToQStash(planSteps);
1869
1869
  break;
1870
1870
  }
1871
1871
  case "partial": {
1872
1872
  const planStep = this.steps.at(-1);
1873
1873
  if (!planStep || planStep.targetStep === void 0) {
1874
- throw new QstashWorkflowError(
1874
+ throw new QStashWorkflowError(
1875
1875
  `There must be a last step and it should have targetStep larger than 0.Received: ${JSON.stringify(planStep)}`
1876
1876
  );
1877
1877
  }
@@ -1882,19 +1882,19 @@ var AutoExecutor = class _AutoExecutor {
1882
1882
  parallelSteps.length,
1883
1883
  planStep.targetStep
1884
1884
  );
1885
- await this.submitStepsToQstash([resultStep]);
1885
+ await this.submitStepsToQStash([resultStep]);
1886
1886
  } catch (error) {
1887
- if (error instanceof QstashWorkflowAbort) {
1887
+ if (error instanceof QStashWorkflowAbort) {
1888
1888
  throw error;
1889
1889
  }
1890
- throw new QstashWorkflowError(
1891
- `Error submitting steps to qstash in partial parallel step execution: ${error}`
1890
+ throw new QStashWorkflowError(
1891
+ `Error submitting steps to QStash in partial parallel step execution: ${error}`
1892
1892
  );
1893
1893
  }
1894
1894
  break;
1895
1895
  }
1896
1896
  case "discard": {
1897
- throw new QstashWorkflowAbort("discarded parallel");
1897
+ throw new QStashWorkflowAbort("discarded parallel");
1898
1898
  }
1899
1899
  case "last": {
1900
1900
  const parallelResultSteps = sortedSteps.filter((step) => step.stepId >= initialStepCount).slice(0, parallelSteps.length);
@@ -1943,10 +1943,10 @@ var AutoExecutor = class _AutoExecutor {
1943
1943
  *
1944
1944
  * @param steps steps to send
1945
1945
  */
1946
- async submitStepsToQstash(steps) {
1946
+ async submitStepsToQStash(steps) {
1947
1947
  if (steps.length === 0) {
1948
- throw new QstashWorkflowError(
1949
- `Unable to submit steps to Qstash. Provided list is empty. Current step: ${this.stepCount}`
1948
+ throw new QStashWorkflowError(
1949
+ `Unable to submit steps to QStash. Provided list is empty. Current step: ${this.stepCount}`
1950
1950
  );
1951
1951
  }
1952
1952
  await this.debug?.log("SUBMIT", "SUBMIT_STEP", { length: steps.length, steps });
@@ -1996,7 +1996,7 @@ var AutoExecutor = class _AutoExecutor {
1996
1996
  };
1997
1997
  })
1998
1998
  });
1999
- throw new QstashWorkflowAbort(steps[0].stepName, steps[0]);
1999
+ throw new QStashWorkflowAbort(steps[0].stepName, steps[0]);
2000
2000
  }
2001
2001
  /**
2002
2002
  * Get the promise by executing the lazt steps list. If there is a single
@@ -2020,7 +2020,7 @@ var AutoExecutor = class _AutoExecutor {
2020
2020
  } else if (Array.isArray(result) && lazyStepList.length === result.length && index < lazyStepList.length) {
2021
2021
  return result[index];
2022
2022
  } else {
2023
- throw new QstashWorkflowError(
2023
+ throw new QStashWorkflowError(
2024
2024
  `Unexpected parallel call result while executing step ${index}: '${result}'. Expected ${lazyStepList.length} many items`
2025
2025
  );
2026
2026
  }
@@ -2032,12 +2032,12 @@ var AutoExecutor = class _AutoExecutor {
2032
2032
  };
2033
2033
  var validateStep = (lazyStep, stepFromRequest) => {
2034
2034
  if (lazyStep.stepName !== stepFromRequest.stepName) {
2035
- throw new QstashWorkflowError(
2035
+ throw new QStashWorkflowError(
2036
2036
  `Incompatible step name. Expected '${lazyStep.stepName}', got '${stepFromRequest.stepName}' from the request`
2037
2037
  );
2038
2038
  }
2039
2039
  if (lazyStep.stepType !== stepFromRequest.stepType) {
2040
- throw new QstashWorkflowError(
2040
+ throw new QStashWorkflowError(
2041
2041
  `Incompatible step type. Expected '${lazyStep.stepType}', got '${stepFromRequest.stepType}' from the request`
2042
2042
  );
2043
2043
  }
@@ -2048,12 +2048,12 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
2048
2048
  validateStep(lazySteps[index], stepFromRequest);
2049
2049
  }
2050
2050
  } catch (error) {
2051
- if (error instanceof QstashWorkflowError) {
2051
+ if (error instanceof QStashWorkflowError) {
2052
2052
  const lazyStepNames = lazySteps.map((lazyStep) => lazyStep.stepName);
2053
2053
  const lazyStepTypes = lazySteps.map((lazyStep) => lazyStep.stepType);
2054
2054
  const requestStepNames = stepsFromRequest.map((step) => step.stepName);
2055
2055
  const requestStepTypes = stepsFromRequest.map((step) => step.stepType);
2056
- throw new QstashWorkflowError(
2056
+ throw new QStashWorkflowError(
2057
2057
  `Incompatible steps detected in parallel execution: ${error.message}
2058
2058
  > Step Names from the request: ${JSON.stringify(requestStepNames)}
2059
2059
  Step Types from the request: ${JSON.stringify(requestStepTypes)}
@@ -2419,14 +2419,14 @@ var WorkflowContext = class {
2419
2419
  var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowContext {
2420
2420
  static disabledMessage = "disabled-qstash-worklfow-run";
2421
2421
  /**
2422
- * overwrite the WorkflowContext.addStep method to always raise QstashWorkflowAbort
2422
+ * overwrite the WorkflowContext.addStep method to always raise QStashWorkflowAbort
2423
2423
  * error in order to stop the execution whenever we encounter a step.
2424
2424
  *
2425
2425
  * @param _step
2426
2426
  */
2427
2427
  // eslint-disable-next-line @typescript-eslint/require-await
2428
2428
  async addStep(_step) {
2429
- throw new QstashWorkflowAbort(_DisabledWorkflowContext.disabledMessage);
2429
+ throw new QStashWorkflowAbort(_DisabledWorkflowContext.disabledMessage);
2430
2430
  }
2431
2431
  /**
2432
2432
  * copies the passed context to create a DisabledWorkflowContext. Then, runs the
@@ -2453,7 +2453,7 @@ var DisabledWorkflowContext = class _DisabledWorkflowContext extends WorkflowCon
2453
2453
  try {
2454
2454
  await routeFunction(disabledContext);
2455
2455
  } catch (error) {
2456
- if (error instanceof QstashWorkflowAbort && error.stepName === this.disabledMessage) {
2456
+ if (error instanceof QStashWorkflowAbort && error.stepName === this.disabledMessage) {
2457
2457
  return ok("step-found");
2458
2458
  }
2459
2459
  return err(error);
@@ -2600,7 +2600,7 @@ var checkIfLastOneIsDuplicate = async (steps, debug) => {
2600
2600
  for (let index = 0; index < steps.length - 1; index++) {
2601
2601
  const step = steps[index];
2602
2602
  if (step.stepId === lastStepId && step.targetStep === lastTargetStepId) {
2603
- 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.`;
2603
+ 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.`;
2604
2604
  await debug?.log("WARN", "RESPONSE_DEFAULT", message);
2605
2605
  console.warn(message);
2606
2606
  return true;
@@ -2612,13 +2612,13 @@ var validateRequest = (request) => {
2612
2612
  const versionHeader = request.headers.get(WORKFLOW_PROTOCOL_VERSION_HEADER);
2613
2613
  const isFirstInvocation = !versionHeader;
2614
2614
  if (!isFirstInvocation && versionHeader !== WORKFLOW_PROTOCOL_VERSION) {
2615
- throw new QstashWorkflowError(
2615
+ throw new QStashWorkflowError(
2616
2616
  `Incompatible workflow sdk protocol version. Expected ${WORKFLOW_PROTOCOL_VERSION}, got ${versionHeader} from the request.`
2617
2617
  );
2618
2618
  }
2619
2619
  const workflowRunId = isFirstInvocation ? `wfr_${nanoid()}` : request.headers.get(WORKFLOW_ID_HEADER) ?? "";
2620
2620
  if (workflowRunId.length === 0) {
2621
- throw new QstashWorkflowError("Couldn't get workflow id from header");
2621
+ throw new QStashWorkflowError("Couldn't get workflow id from header");
2622
2622
  }
2623
2623
  return {
2624
2624
  isFirstInvocation,
@@ -2634,7 +2634,7 @@ var parseRequest = async (requestPayload, isFirstInvocation, debug) => {
2634
2634
  };
2635
2635
  } else {
2636
2636
  if (!requestPayload) {
2637
- throw new QstashWorkflowError("Only first call can have an empty body");
2637
+ throw new QStashWorkflowError("Only first call can have an empty body");
2638
2638
  }
2639
2639
  const { rawInitialPayload, steps } = parsePayload(requestPayload);
2640
2640
  const isLastDuplicate = await checkIfLastOneIsDuplicate(steps, debug);
@@ -2652,7 +2652,7 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
2652
2652
  }
2653
2653
  if (!failureFunction) {
2654
2654
  return err(
2655
- new QstashWorkflowError(
2655
+ new QStashWorkflowError(
2656
2656
  "Workflow endpoint is called to handle a failure, but a failureFunction is not provided in serve options. Either provide a failureUrl or a failureFunction."
2657
2657
  )
2658
2658
  );
@@ -2854,8 +2854,8 @@ export {
2854
2854
  QstashRatelimitError,
2855
2855
  QstashChatRatelimitError,
2856
2856
  QstashDailyRatelimitError,
2857
- QstashWorkflowError,
2858
- QstashWorkflowAbort,
2857
+ QStashWorkflowError,
2858
+ QStashWorkflowAbort,
2859
2859
  formatWorkflowError,
2860
2860
  setupAnalytics,
2861
2861
  upstash,
@@ -158,20 +158,20 @@ var QstashDailyRatelimitError = class extends QstashError {
158
158
  this.name = "QstashChatRatelimitError";
159
159
  }
160
160
  };
161
- var QstashWorkflowError = class extends QstashError {
161
+ var QStashWorkflowError = class extends QstashError {
162
162
  constructor(message) {
163
163
  super(message);
164
- this.name = "QstashWorkflowError";
164
+ this.name = "QStashWorkflowError";
165
165
  }
166
166
  };
167
- var QstashWorkflowAbort = class extends Error {
167
+ var QStashWorkflowAbort = class extends Error {
168
168
 
169
169
 
170
170
  constructor(stepName, stepInfo) {
171
171
  super(
172
172
  `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}'.`
173
173
  );
174
- this.name = "QstashWorkflowAbort";
174
+ this.name = "QStashWorkflowAbort";
175
175
  this.stepName = stepName;
176
176
  this.stepInfo = stepInfo;
177
177
  }
@@ -1561,7 +1561,7 @@ var triggerRouteFunction = async ({
1561
1561
  return ok("workflow-finished");
1562
1562
  } catch (error) {
1563
1563
  const error_ = error;
1564
- return error_ instanceof QstashWorkflowAbort ? ok("step-finished") : err(error_);
1564
+ return error_ instanceof QStashWorkflowAbort ? ok("step-finished") : err(error_);
1565
1565
  }
1566
1566
  };
1567
1567
  var triggerWorkflowDelete = async (workflowContext, debug, cancel = false) => {
@@ -1649,7 +1649,7 @@ var handleThirdPartyCallResult = async (request, requestPayload, client, workflo
1649
1649
  } catch (error) {
1650
1650
  const isCallReturn = request.headers.get("Upstash-Workflow-Callback");
1651
1651
  return err(
1652
- new QstashWorkflowError(
1652
+ new QStashWorkflowError(
1653
1653
  `Error when handling call return (isCallReturn=${isCallReturn}): ${error}`
1654
1654
  )
1655
1655
  );
@@ -1717,7 +1717,7 @@ var verifyRequest = async (body, signature, verifier) => {
1717
1717
  throw new Error("Signature in `Upstash-Signature` header is not valid");
1718
1718
  }
1719
1719
  } catch (error) {
1720
- throw new QstashWorkflowError(
1720
+ throw new QStashWorkflowError(
1721
1721
  `Failed to verify that the Workflow request comes from QStash: ${error}
1722
1722
 
1723
1723
  If signature is missing, trigger the workflow endpoint by publishing your request to QStash instead of calling it directly.
@@ -1757,14 +1757,14 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
1757
1757
  *
1758
1758
  * If a function is already executing (this.executingStep), this
1759
1759
  * means that there is a nested step which is not allowed. In this
1760
- * case, addStep throws QstashWorkflowError.
1760
+ * case, addStep throws QStashWorkflowError.
1761
1761
  *
1762
1762
  * @param stepInfo step plan to add
1763
1763
  * @returns result of the step function
1764
1764
  */
1765
1765
  async addStep(stepInfo) {
1766
1766
  if (this.executingStep) {
1767
- throw new QstashWorkflowError(
1767
+ throw new QStashWorkflowError(
1768
1768
  `A step can not be run inside another step. Tried to run '${stepInfo.stepName}' inside '${this.executingStep}'`
1769
1769
  );
1770
1770
  }
@@ -1833,7 +1833,7 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
1833
1833
  step: resultStep,
1834
1834
  stepCount: this.stepCount
1835
1835
  })]);
1836
- await this.submitStepsToQstash([resultStep]);
1836
+ await this.submitStepsToQStash([resultStep]);
1837
1837
  return resultStep.out;
1838
1838
  }
1839
1839
  /**
@@ -1849,7 +1849,7 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
1849
1849
  const sortedSteps = sortSteps(this.steps);
1850
1850
  const plannedParallelStepCount = _optionalChain([sortedSteps, 'access', _53 => _53[initialStepCount + this.planStepCount], 'optionalAccess', _54 => _54.concurrent]);
1851
1851
  if (parallelCallState !== "first" && plannedParallelStepCount !== parallelSteps.length) {
1852
- throw new QstashWorkflowError(
1852
+ throw new QStashWorkflowError(
1853
1853
  `Incompatible number of parallel steps when call state was '${parallelCallState}'. Expected ${parallelSteps.length}, got ${plannedParallelStepCount} from the request.`
1854
1854
  );
1855
1855
  }
@@ -1865,13 +1865,13 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
1865
1865
  const planSteps = parallelSteps.map(
1866
1866
  (parallelStep, index) => parallelStep.getPlanStep(parallelSteps.length, initialStepCount + index)
1867
1867
  );
1868
- await this.submitStepsToQstash(planSteps);
1868
+ await this.submitStepsToQStash(planSteps);
1869
1869
  break;
1870
1870
  }
1871
1871
  case "partial": {
1872
1872
  const planStep = this.steps.at(-1);
1873
1873
  if (!planStep || planStep.targetStep === void 0) {
1874
- throw new QstashWorkflowError(
1874
+ throw new QStashWorkflowError(
1875
1875
  `There must be a last step and it should have targetStep larger than 0.Received: ${JSON.stringify(planStep)}`
1876
1876
  );
1877
1877
  }
@@ -1882,19 +1882,19 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
1882
1882
  parallelSteps.length,
1883
1883
  planStep.targetStep
1884
1884
  );
1885
- await this.submitStepsToQstash([resultStep]);
1885
+ await this.submitStepsToQStash([resultStep]);
1886
1886
  } catch (error) {
1887
- if (error instanceof QstashWorkflowAbort) {
1887
+ if (error instanceof QStashWorkflowAbort) {
1888
1888
  throw error;
1889
1889
  }
1890
- throw new QstashWorkflowError(
1891
- `Error submitting steps to qstash in partial parallel step execution: ${error}`
1890
+ throw new QStashWorkflowError(
1891
+ `Error submitting steps to QStash in partial parallel step execution: ${error}`
1892
1892
  );
1893
1893
  }
1894
1894
  break;
1895
1895
  }
1896
1896
  case "discard": {
1897
- throw new QstashWorkflowAbort("discarded parallel");
1897
+ throw new QStashWorkflowAbort("discarded parallel");
1898
1898
  }
1899
1899
  case "last": {
1900
1900
  const parallelResultSteps = sortedSteps.filter((step) => step.stepId >= initialStepCount).slice(0, parallelSteps.length);
@@ -1943,10 +1943,10 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
1943
1943
  *
1944
1944
  * @param steps steps to send
1945
1945
  */
1946
- async submitStepsToQstash(steps) {
1946
+ async submitStepsToQStash(steps) {
1947
1947
  if (steps.length === 0) {
1948
- throw new QstashWorkflowError(
1949
- `Unable to submit steps to Qstash. Provided list is empty. Current step: ${this.stepCount}`
1948
+ throw new QStashWorkflowError(
1949
+ `Unable to submit steps to QStash. Provided list is empty. Current step: ${this.stepCount}`
1950
1950
  );
1951
1951
  }
1952
1952
  await _optionalChain([this, 'access', _61 => _61.debug, 'optionalAccess', _62 => _62.log, 'call', _63 => _63("SUBMIT", "SUBMIT_STEP", { length: steps.length, steps })]);
@@ -1996,7 +1996,7 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
1996
1996
  };
1997
1997
  })
1998
1998
  })]);
1999
- throw new QstashWorkflowAbort(steps[0].stepName, steps[0]);
1999
+ throw new QStashWorkflowAbort(steps[0].stepName, steps[0]);
2000
2000
  }
2001
2001
  /**
2002
2002
  * Get the promise by executing the lazt steps list. If there is a single
@@ -2020,7 +2020,7 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
2020
2020
  } else if (Array.isArray(result) && lazyStepList.length === result.length && index < lazyStepList.length) {
2021
2021
  return result[index];
2022
2022
  } else {
2023
- throw new QstashWorkflowError(
2023
+ throw new QStashWorkflowError(
2024
2024
  `Unexpected parallel call result while executing step ${index}: '${result}'. Expected ${lazyStepList.length} many items`
2025
2025
  );
2026
2026
  }
@@ -2032,12 +2032,12 @@ var AutoExecutor = (_class3 = class _AutoExecutor {
2032
2032
  }, _class3);
2033
2033
  var validateStep = (lazyStep, stepFromRequest) => {
2034
2034
  if (lazyStep.stepName !== stepFromRequest.stepName) {
2035
- throw new QstashWorkflowError(
2035
+ throw new QStashWorkflowError(
2036
2036
  `Incompatible step name. Expected '${lazyStep.stepName}', got '${stepFromRequest.stepName}' from the request`
2037
2037
  );
2038
2038
  }
2039
2039
  if (lazyStep.stepType !== stepFromRequest.stepType) {
2040
- throw new QstashWorkflowError(
2040
+ throw new QStashWorkflowError(
2041
2041
  `Incompatible step type. Expected '${lazyStep.stepType}', got '${stepFromRequest.stepType}' from the request`
2042
2042
  );
2043
2043
  }
@@ -2048,12 +2048,12 @@ var validateParallelSteps = (lazySteps, stepsFromRequest) => {
2048
2048
  validateStep(lazySteps[index], stepFromRequest);
2049
2049
  }
2050
2050
  } catch (error) {
2051
- if (error instanceof QstashWorkflowError) {
2051
+ if (error instanceof QStashWorkflowError) {
2052
2052
  const lazyStepNames = lazySteps.map((lazyStep) => lazyStep.stepName);
2053
2053
  const lazyStepTypes = lazySteps.map((lazyStep) => lazyStep.stepType);
2054
2054
  const requestStepNames = stepsFromRequest.map((step) => step.stepName);
2055
2055
  const requestStepTypes = stepsFromRequest.map((step) => step.stepType);
2056
- throw new QstashWorkflowError(
2056
+ throw new QStashWorkflowError(
2057
2057
  `Incompatible steps detected in parallel execution: ${error.message}
2058
2058
  > Step Names from the request: ${JSON.stringify(requestStepNames)}
2059
2059
  Step Types from the request: ${JSON.stringify(requestStepTypes)}
@@ -2419,14 +2419,14 @@ var WorkflowContext = class {
2419
2419
  var DisabledWorkflowContext = (_class8 = class _DisabledWorkflowContext extends WorkflowContext {
2420
2420
  static __initStatic() {this.disabledMessage = "disabled-qstash-worklfow-run"}
2421
2421
  /**
2422
- * overwrite the WorkflowContext.addStep method to always raise QstashWorkflowAbort
2422
+ * overwrite the WorkflowContext.addStep method to always raise QStashWorkflowAbort
2423
2423
  * error in order to stop the execution whenever we encounter a step.
2424
2424
  *
2425
2425
  * @param _step
2426
2426
  */
2427
2427
  // eslint-disable-next-line @typescript-eslint/require-await
2428
2428
  async addStep(_step) {
2429
- throw new QstashWorkflowAbort(_DisabledWorkflowContext.disabledMessage);
2429
+ throw new QStashWorkflowAbort(_DisabledWorkflowContext.disabledMessage);
2430
2430
  }
2431
2431
  /**
2432
2432
  * copies the passed context to create a DisabledWorkflowContext. Then, runs the
@@ -2453,7 +2453,7 @@ var DisabledWorkflowContext = (_class8 = class _DisabledWorkflowContext extends
2453
2453
  try {
2454
2454
  await routeFunction(disabledContext);
2455
2455
  } catch (error) {
2456
- if (error instanceof QstashWorkflowAbort && error.stepName === this.disabledMessage) {
2456
+ if (error instanceof QStashWorkflowAbort && error.stepName === this.disabledMessage) {
2457
2457
  return ok("step-found");
2458
2458
  }
2459
2459
  return err(error);
@@ -2600,7 +2600,7 @@ var checkIfLastOneIsDuplicate = async (steps, debug) => {
2600
2600
  for (let index = 0; index < steps.length - 1; index++) {
2601
2601
  const step = steps[index];
2602
2602
  if (step.stepId === lastStepId && step.targetStep === lastTargetStepId) {
2603
- 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.`;
2603
+ 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.`;
2604
2604
  await _optionalChain([debug, 'optionalAccess', _67 => _67.log, 'call', _68 => _68("WARN", "RESPONSE_DEFAULT", message)]);
2605
2605
  console.warn(message);
2606
2606
  return true;
@@ -2612,13 +2612,13 @@ var validateRequest = (request) => {
2612
2612
  const versionHeader = request.headers.get(WORKFLOW_PROTOCOL_VERSION_HEADER);
2613
2613
  const isFirstInvocation = !versionHeader;
2614
2614
  if (!isFirstInvocation && versionHeader !== WORKFLOW_PROTOCOL_VERSION) {
2615
- throw new QstashWorkflowError(
2615
+ throw new QStashWorkflowError(
2616
2616
  `Incompatible workflow sdk protocol version. Expected ${WORKFLOW_PROTOCOL_VERSION}, got ${versionHeader} from the request.`
2617
2617
  );
2618
2618
  }
2619
2619
  const workflowRunId = isFirstInvocation ? `wfr_${nanoid()}` : _nullishCoalesce(request.headers.get(WORKFLOW_ID_HEADER), () => ( ""));
2620
2620
  if (workflowRunId.length === 0) {
2621
- throw new QstashWorkflowError("Couldn't get workflow id from header");
2621
+ throw new QStashWorkflowError("Couldn't get workflow id from header");
2622
2622
  }
2623
2623
  return {
2624
2624
  isFirstInvocation,
@@ -2634,7 +2634,7 @@ var parseRequest = async (requestPayload, isFirstInvocation, debug) => {
2634
2634
  };
2635
2635
  } else {
2636
2636
  if (!requestPayload) {
2637
- throw new QstashWorkflowError("Only first call can have an empty body");
2637
+ throw new QStashWorkflowError("Only first call can have an empty body");
2638
2638
  }
2639
2639
  const { rawInitialPayload, steps } = parsePayload(requestPayload);
2640
2640
  const isLastDuplicate = await checkIfLastOneIsDuplicate(steps, debug);
@@ -2652,7 +2652,7 @@ var handleFailure = async (request, requestPayload, qstashClient, initialPayload
2652
2652
  }
2653
2653
  if (!failureFunction) {
2654
2654
  return err(
2655
- new QstashWorkflowError(
2655
+ new QStashWorkflowError(
2656
2656
  "Workflow endpoint is called to handle a failure, but a failureFunction is not provided in serve options. Either provide a failureUrl or a failureFunction."
2657
2657
  )
2658
2658
  );
@@ -2873,4 +2873,4 @@ var Workflow = class {
2873
2873
 
2874
2874
 
2875
2875
 
2876
- exports.SignatureError = SignatureError; exports.Receiver = Receiver; exports.QstashError = QstashError; exports.QstashRatelimitError = QstashRatelimitError; exports.QstashChatRatelimitError = QstashChatRatelimitError; exports.QstashDailyRatelimitError = QstashDailyRatelimitError; exports.QstashWorkflowError = QstashWorkflowError; exports.QstashWorkflowAbort = QstashWorkflowAbort; exports.formatWorkflowError = formatWorkflowError; exports.setupAnalytics = setupAnalytics; exports.upstash = upstash; exports.openai = openai; exports.custom = custom; exports.Chat = Chat; exports.Messages = Messages; exports.Schedules = Schedules; exports.UrlGroups = UrlGroups; exports.StepTypes = StepTypes; exports.WorkflowContext = WorkflowContext; exports.DisabledWorkflowContext = DisabledWorkflowContext; exports.WorkflowLogger = WorkflowLogger; exports.processOptions = processOptions; exports.serve = serve; exports.Workflow = Workflow; exports.Client = Client;
2876
+ exports.SignatureError = SignatureError; exports.Receiver = Receiver; exports.QstashError = QstashError; exports.QstashRatelimitError = QstashRatelimitError; exports.QstashChatRatelimitError = QstashChatRatelimitError; exports.QstashDailyRatelimitError = QstashDailyRatelimitError; exports.QStashWorkflowError = QStashWorkflowError; exports.QStashWorkflowAbort = QStashWorkflowAbort; exports.formatWorkflowError = formatWorkflowError; exports.setupAnalytics = setupAnalytics; exports.upstash = upstash; exports.openai = openai; exports.custom = custom; exports.Chat = Chat; exports.Messages = Messages; exports.Schedules = Schedules; exports.UrlGroups = UrlGroups; exports.StepTypes = StepTypes; exports.WorkflowContext = WorkflowContext; exports.DisabledWorkflowContext = DisabledWorkflowContext; exports.WorkflowLogger = WorkflowLogger; exports.processOptions = processOptions; exports.serve = serve; exports.Workflow = Workflow; exports.Client = Client;
@@ -891,7 +891,7 @@ declare class AutoExecutor {
891
891
  *
892
892
  * If a function is already executing (this.executingStep), this
893
893
  * means that there is a nested step which is not allowed. In this
894
- * case, addStep throws QstashWorkflowError.
894
+ * case, addStep throws QStashWorkflowError.
895
895
  *
896
896
  * @param stepInfo step plan to add
897
897
  * @returns result of the step function
@@ -955,7 +955,7 @@ declare class AutoExecutor {
955
955
  *
956
956
  * @param steps steps to send
957
957
  */
958
- private submitStepsToQstash;
958
+ private submitStepsToQStash;
959
959
  /**
960
960
  * Get the promise by executing the lazt steps list. If there is a single
961
961
  * step, we call `runSingle`. Otherwise `runParallel` is called.
@@ -995,7 +995,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
995
995
  * )
996
996
  * ```
997
997
  */
998
- readonly qstashClient: Client;
998
+ readonly qstashClient: WorkflowClient;
999
999
  /**
1000
1000
  * Run id of the workflow
1001
1001
  */
@@ -1075,7 +1075,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
1075
1075
  */
1076
1076
  readonly rawInitialPayload: string;
1077
1077
  constructor({ qstashClient, workflowRunId, headers, steps, url, failureUrl, debug, initialPayload, rawInitialPayload, }: {
1078
- qstashClient: Client;
1078
+ qstashClient: WorkflowClient;
1079
1079
  workflowRunId: string;
1080
1080
  headers: Headers;
1081
1081
  steps: Step[];
@@ -1158,7 +1158,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
1158
1158
  protected addStep<TResult = unknown>(step: BaseLazyStep<TResult>): Promise<TResult>;
1159
1159
  }
1160
1160
  /**
1161
- * Workflow context which throws QstashWorkflowAbort before running the steps.
1161
+ * Workflow context which throws QStashWorkflowAbort before running the steps.
1162
1162
  *
1163
1163
  * Used for making a dry run before running any steps to check authentication.
1164
1164
  *
@@ -1185,7 +1185,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
1185
1185
  declare class DisabledWorkflowContext<TInitialPayload = unknown> extends WorkflowContext<TInitialPayload> {
1186
1186
  private static readonly disabledMessage;
1187
1187
  /**
1188
- * overwrite the WorkflowContext.addStep method to always raise QstashWorkflowAbort
1188
+ * overwrite the WorkflowContext.addStep method to always raise QStashWorkflowAbort
1189
1189
  * error in order to stop the execution whenever we encounter a step.
1190
1190
  *
1191
1191
  * @param _step
@@ -1205,6 +1205,24 @@ declare class DisabledWorkflowContext<TInitialPayload = unknown> extends Workflo
1205
1205
  static tryAuthentication<TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, context: WorkflowContext<TInitialPayload>): Promise<Ok<"step-found" | "run-ended", never> | Err<never, Error>>;
1206
1206
  }
1207
1207
 
1208
+ /**
1209
+ * Interface for Client with required methods
1210
+ *
1211
+ * Neeeded to resolve import issues
1212
+ */
1213
+ type WorkflowClient = {
1214
+ batchJSON: InstanceType<typeof Client>["batchJSON"];
1215
+ publishJSON: InstanceType<typeof Client>["publishJSON"];
1216
+ http: InstanceType<typeof Client>["http"];
1217
+ };
1218
+ /**
1219
+ * Interface for Receiver with required methods
1220
+ *
1221
+ * Neeeded to resolve import issues
1222
+ */
1223
+ type WorkflowReceiver = {
1224
+ verify: InstanceType<typeof Receiver>["verify"];
1225
+ };
1208
1226
  declare const StepTypes: readonly ["Initial", "Run", "SleepFor", "SleepUntil", "Call"];
1209
1227
  type StepType = (typeof StepTypes)[number];
1210
1228
  type ThirdPartyCallFields<TBody = unknown> = {
@@ -1281,7 +1299,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
1281
1299
  /**
1282
1300
  * QStash client
1283
1301
  */
1284
- qstashClient?: Client;
1302
+ qstashClient?: WorkflowClient;
1285
1303
  /**
1286
1304
  * Function called to return a response after each step execution
1287
1305
  *
@@ -1313,7 +1331,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
1313
1331
  * By default, a receiver is created from the env variables
1314
1332
  * QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY if they are set.
1315
1333
  */
1316
- receiver?: Receiver;
1334
+ receiver?: WorkflowReceiver;
1317
1335
  /**
1318
1336
  * Url to call if QStash retries are exhausted while executing the workflow
1319
1337
  */
@@ -1401,7 +1419,7 @@ declare class Workflow {
1401
1419
 
1402
1420
  type ClientConfig = {
1403
1421
  /**
1404
- * Url of the qstash api server.
1422
+ * Url of the QStash api server.
1405
1423
  *
1406
1424
  * This is only used for testing.
1407
1425
  *
@@ -1724,4 +1742,4 @@ type PublishResponse<TRequest> = TRequest extends {
1724
1742
  urlGroup: string;
1725
1743
  } ? PublishToUrlGroupsResponse : PublishToApiResponse;
1726
1744
 
1727
- export { type AnalyticsConfig as $, type AddEndpointsRequest as A, type BodyInit as B, type ChatRateLimit as C, type ChatCompletion as D, type EventsRequest as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type ChatCompletionChunk as I, type StreamEnabled as J, type StreamDisabled as K, type StreamParameter as L, type Message as M, type PromptChatRequest as N, type OpenAIChatModel as O, type PublishBatchRequest as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type ChatRequest as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, custom as X, openai as Y, upstash as Z, type ProviderReturnType as _, type ReceiverConfig as a, type AnalyticsSetup as a0, setupAnalytics as a1, type RouteFunction as a2, type WorkflowServeOptions as a3, Workflow as a4, processOptions as a5, serve as a6, WorkflowContext as a7, DisabledWorkflowContext as a8, StepTypes as a9, type StepType as aa, type RawStep as ab, type SyncStepFunction as ac, type AsyncStepFunction as ad, type StepFunction as ae, type ParallelCallState as af, type FinishCondition as ag, type RequiredExceptFields as ah, type LogLevel as ai, type WorkflowLoggerOptions as aj, WorkflowLogger as ak, SignatureError as b, Receiver as c, type PublishRequest as d, type PublishJsonRequest as e, Client as f, type PublishToApiResponse as g, type PublishToUrlResponse as h, type PublishToUrlGroupsResponse as i, type PublishResponse as j, type MessagePayload as k, Messages as l, type Schedule as m, type CreateScheduleRequest as n, Schedules as o, type Endpoint as p, type RemoveEndpointsRequest as q, UrlGroups as r, type State as s, type Event as t, type EventPayload as u, type GetEventsPayload as v, type HeadersInit as w, type RequestOptions as x, Chat as y, type ChatCompletionMessage as z };
1745
+ export { type AnalyticsConfig as $, type AddEndpointsRequest as A, type BodyInit as B, type ChatRateLimit as C, type ChatCompletion as D, type EventsRequest as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type ChatCompletionChunk as I, type StreamEnabled as J, type StreamDisabled as K, type StreamParameter as L, type Message as M, type PromptChatRequest as N, type OpenAIChatModel as O, type PublishBatchRequest as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type ChatRequest as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, custom as X, openai as Y, upstash as Z, type ProviderReturnType as _, type ReceiverConfig as a, type AnalyticsSetup as a0, setupAnalytics as a1, type RouteFunction as a2, type WorkflowServeOptions as a3, Workflow as a4, processOptions as a5, serve as a6, WorkflowContext as a7, DisabledWorkflowContext as a8, type WorkflowClient as a9, type WorkflowReceiver as aa, StepTypes as ab, type StepType as ac, type RawStep as ad, type SyncStepFunction as ae, type AsyncStepFunction as af, type StepFunction as ag, type ParallelCallState as ah, type FinishCondition as ai, type RequiredExceptFields as aj, type LogLevel as ak, type WorkflowLoggerOptions as al, WorkflowLogger as am, SignatureError as b, Receiver as c, type PublishRequest as d, type PublishJsonRequest as e, Client as f, type PublishToApiResponse as g, type PublishToUrlResponse as h, type PublishToUrlGroupsResponse as i, type PublishResponse as j, type MessagePayload as k, Messages as l, type Schedule as m, type CreateScheduleRequest as n, Schedules as o, type Endpoint as p, type RemoveEndpointsRequest as q, UrlGroups as r, type State as s, type Event as t, type EventPayload as u, type GetEventsPayload as v, type HeadersInit as w, type RequestOptions as x, Chat as y, type ChatCompletionMessage as z };
@@ -891,7 +891,7 @@ declare class AutoExecutor {
891
891
  *
892
892
  * If a function is already executing (this.executingStep), this
893
893
  * means that there is a nested step which is not allowed. In this
894
- * case, addStep throws QstashWorkflowError.
894
+ * case, addStep throws QStashWorkflowError.
895
895
  *
896
896
  * @param stepInfo step plan to add
897
897
  * @returns result of the step function
@@ -955,7 +955,7 @@ declare class AutoExecutor {
955
955
  *
956
956
  * @param steps steps to send
957
957
  */
958
- private submitStepsToQstash;
958
+ private submitStepsToQStash;
959
959
  /**
960
960
  * Get the promise by executing the lazt steps list. If there is a single
961
961
  * step, we call `runSingle`. Otherwise `runParallel` is called.
@@ -995,7 +995,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
995
995
  * )
996
996
  * ```
997
997
  */
998
- readonly qstashClient: Client;
998
+ readonly qstashClient: WorkflowClient;
999
999
  /**
1000
1000
  * Run id of the workflow
1001
1001
  */
@@ -1075,7 +1075,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
1075
1075
  */
1076
1076
  readonly rawInitialPayload: string;
1077
1077
  constructor({ qstashClient, workflowRunId, headers, steps, url, failureUrl, debug, initialPayload, rawInitialPayload, }: {
1078
- qstashClient: Client;
1078
+ qstashClient: WorkflowClient;
1079
1079
  workflowRunId: string;
1080
1080
  headers: Headers;
1081
1081
  steps: Step[];
@@ -1158,7 +1158,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
1158
1158
  protected addStep<TResult = unknown>(step: BaseLazyStep<TResult>): Promise<TResult>;
1159
1159
  }
1160
1160
  /**
1161
- * Workflow context which throws QstashWorkflowAbort before running the steps.
1161
+ * Workflow context which throws QStashWorkflowAbort before running the steps.
1162
1162
  *
1163
1163
  * Used for making a dry run before running any steps to check authentication.
1164
1164
  *
@@ -1185,7 +1185,7 @@ declare class WorkflowContext<TInitialPayload = unknown> {
1185
1185
  declare class DisabledWorkflowContext<TInitialPayload = unknown> extends WorkflowContext<TInitialPayload> {
1186
1186
  private static readonly disabledMessage;
1187
1187
  /**
1188
- * overwrite the WorkflowContext.addStep method to always raise QstashWorkflowAbort
1188
+ * overwrite the WorkflowContext.addStep method to always raise QStashWorkflowAbort
1189
1189
  * error in order to stop the execution whenever we encounter a step.
1190
1190
  *
1191
1191
  * @param _step
@@ -1205,6 +1205,24 @@ declare class DisabledWorkflowContext<TInitialPayload = unknown> extends Workflo
1205
1205
  static tryAuthentication<TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, context: WorkflowContext<TInitialPayload>): Promise<Ok<"step-found" | "run-ended", never> | Err<never, Error>>;
1206
1206
  }
1207
1207
 
1208
+ /**
1209
+ * Interface for Client with required methods
1210
+ *
1211
+ * Neeeded to resolve import issues
1212
+ */
1213
+ type WorkflowClient = {
1214
+ batchJSON: InstanceType<typeof Client>["batchJSON"];
1215
+ publishJSON: InstanceType<typeof Client>["publishJSON"];
1216
+ http: InstanceType<typeof Client>["http"];
1217
+ };
1218
+ /**
1219
+ * Interface for Receiver with required methods
1220
+ *
1221
+ * Neeeded to resolve import issues
1222
+ */
1223
+ type WorkflowReceiver = {
1224
+ verify: InstanceType<typeof Receiver>["verify"];
1225
+ };
1208
1226
  declare const StepTypes: readonly ["Initial", "Run", "SleepFor", "SleepUntil", "Call"];
1209
1227
  type StepType = (typeof StepTypes)[number];
1210
1228
  type ThirdPartyCallFields<TBody = unknown> = {
@@ -1281,7 +1299,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
1281
1299
  /**
1282
1300
  * QStash client
1283
1301
  */
1284
- qstashClient?: Client;
1302
+ qstashClient?: WorkflowClient;
1285
1303
  /**
1286
1304
  * Function called to return a response after each step execution
1287
1305
  *
@@ -1313,7 +1331,7 @@ type WorkflowServeOptions<TResponse extends Response = Response, TInitialPayload
1313
1331
  * By default, a receiver is created from the env variables
1314
1332
  * QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY if they are set.
1315
1333
  */
1316
- receiver?: Receiver;
1334
+ receiver?: WorkflowReceiver;
1317
1335
  /**
1318
1336
  * Url to call if QStash retries are exhausted while executing the workflow
1319
1337
  */
@@ -1401,7 +1419,7 @@ declare class Workflow {
1401
1419
 
1402
1420
  type ClientConfig = {
1403
1421
  /**
1404
- * Url of the qstash api server.
1422
+ * Url of the QStash api server.
1405
1423
  *
1406
1424
  * This is only used for testing.
1407
1425
  *
@@ -1724,4 +1742,4 @@ type PublishResponse<TRequest> = TRequest extends {
1724
1742
  urlGroup: string;
1725
1743
  } ? PublishToUrlGroupsResponse : PublishToApiResponse;
1726
1744
 
1727
- export { type AnalyticsConfig as $, type AddEndpointsRequest as A, type BodyInit as B, type ChatRateLimit as C, type ChatCompletion as D, type EventsRequest as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type ChatCompletionChunk as I, type StreamEnabled as J, type StreamDisabled as K, type StreamParameter as L, type Message as M, type PromptChatRequest as N, type OpenAIChatModel as O, type PublishBatchRequest as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type ChatRequest as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, custom as X, openai as Y, upstash as Z, type ProviderReturnType as _, type ReceiverConfig as a, type AnalyticsSetup as a0, setupAnalytics as a1, type RouteFunction as a2, type WorkflowServeOptions as a3, Workflow as a4, processOptions as a5, serve as a6, WorkflowContext as a7, DisabledWorkflowContext as a8, StepTypes as a9, type StepType as aa, type RawStep as ab, type SyncStepFunction as ac, type AsyncStepFunction as ad, type StepFunction as ae, type ParallelCallState as af, type FinishCondition as ag, type RequiredExceptFields as ah, type LogLevel as ai, type WorkflowLoggerOptions as aj, WorkflowLogger as ak, SignatureError as b, Receiver as c, type PublishRequest as d, type PublishJsonRequest as e, Client as f, type PublishToApiResponse as g, type PublishToUrlResponse as h, type PublishToUrlGroupsResponse as i, type PublishResponse as j, type MessagePayload as k, Messages as l, type Schedule as m, type CreateScheduleRequest as n, Schedules as o, type Endpoint as p, type RemoveEndpointsRequest as q, UrlGroups as r, type State as s, type Event as t, type EventPayload as u, type GetEventsPayload as v, type HeadersInit as w, type RequestOptions as x, Chat as y, type ChatCompletionMessage as z };
1745
+ export { type AnalyticsConfig as $, type AddEndpointsRequest as A, type BodyInit as B, type ChatRateLimit as C, type ChatCompletion as D, type EventsRequest as E, type FailureFunctionPayload as F, type GetEventsResponse as G, type HTTPMethods as H, type ChatCompletionChunk as I, type StreamEnabled as J, type StreamDisabled as K, type StreamParameter as L, type Message as M, type PromptChatRequest as N, type OpenAIChatModel as O, type PublishBatchRequest as P, type QueueRequest as Q, type RateLimit as R, type Step as S, type ChatRequest as T, type UrlGroup as U, type VerifyRequest as V, type WithCursor as W, custom as X, openai as Y, upstash as Z, type ProviderReturnType as _, type ReceiverConfig as a, type AnalyticsSetup as a0, setupAnalytics as a1, type RouteFunction as a2, type WorkflowServeOptions as a3, Workflow as a4, processOptions as a5, serve as a6, WorkflowContext as a7, DisabledWorkflowContext as a8, type WorkflowClient as a9, type WorkflowReceiver as aa, StepTypes as ab, type StepType as ac, type RawStep as ad, type SyncStepFunction as ae, type AsyncStepFunction as af, type StepFunction as ag, type ParallelCallState as ah, type FinishCondition as ai, type RequiredExceptFields as aj, type LogLevel as ak, type WorkflowLoggerOptions as al, WorkflowLogger as am, SignatureError as b, Receiver as c, type PublishRequest as d, type PublishJsonRequest as e, Client as f, type PublishToApiResponse as g, type PublishToUrlResponse as h, type PublishToUrlGroupsResponse as i, type PublishResponse as j, type MessagePayload as k, Messages as l, type Schedule as m, type CreateScheduleRequest as n, Schedules as o, type Endpoint as p, type RemoveEndpointsRequest as q, UrlGroups as r, type State as s, type Event as t, type EventPayload as u, type GetEventsPayload as v, type HeadersInit as w, type RequestOptions as x, Chat as y, type ChatCompletionMessage as z };
package/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-BBvt1wQq.mjs';
2
- export { A as AddEndpointsRequest, $ as AnalyticsConfig, a0 as AnalyticsSetup, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, a1 as setupAnalytics, Z as upstash } from './client-BBvt1wQq.mjs';
1
+ import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-CMBMVtW3.mjs';
2
+ export { A as AddEndpointsRequest, $ as AnalyticsConfig, a0 as AnalyticsSetup, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, a1 as setupAnalytics, Z as upstash } from './client-CMBMVtW3.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  /**
@@ -32,13 +32,13 @@ declare class QstashDailyRatelimitError extends QstashError {
32
32
  /**
33
33
  * Error raised during Workflow execution
34
34
  */
35
- declare class QstashWorkflowError extends QstashError {
35
+ declare class QStashWorkflowError extends QstashError {
36
36
  constructor(message: string);
37
37
  }
38
38
  /**
39
39
  * Raised when the workflow executes a function and aborts
40
40
  */
41
- declare class QstashWorkflowAbort extends Error {
41
+ declare class QStashWorkflowAbort extends Error {
42
42
  stepInfo?: Step;
43
43
  stepName: string;
44
44
  constructor(stepName: string, stepInfo?: Step);
@@ -51,4 +51,4 @@ declare class QstashWorkflowAbort extends Error {
51
51
  */
52
52
  declare const formatWorkflowError: (error: unknown) => FailureFunctionPayload;
53
53
 
54
- export { ChatRateLimit, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, QstashWorkflowAbort, QstashWorkflowError, RateLimit, formatWorkflowError };
54
+ export { ChatRateLimit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, RateLimit, formatWorkflowError };
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-BBvt1wQq.js';
2
- export { A as AddEndpointsRequest, $ as AnalyticsConfig, a0 as AnalyticsSetup, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, a1 as setupAnalytics, Z as upstash } from './client-BBvt1wQq.js';
1
+ import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-CMBMVtW3.js';
2
+ export { A as AddEndpointsRequest, $ as AnalyticsConfig, a0 as AnalyticsSetup, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, a1 as setupAnalytics, Z as upstash } from './client-CMBMVtW3.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  /**
@@ -32,13 +32,13 @@ declare class QstashDailyRatelimitError extends QstashError {
32
32
  /**
33
33
  * Error raised during Workflow execution
34
34
  */
35
- declare class QstashWorkflowError extends QstashError {
35
+ declare class QStashWorkflowError extends QstashError {
36
36
  constructor(message: string);
37
37
  }
38
38
  /**
39
39
  * Raised when the workflow executes a function and aborts
40
40
  */
41
- declare class QstashWorkflowAbort extends Error {
41
+ declare class QStashWorkflowAbort extends Error {
42
42
  stepInfo?: Step;
43
43
  stepName: string;
44
44
  constructor(stepName: string, stepInfo?: Step);
@@ -51,4 +51,4 @@ declare class QstashWorkflowAbort extends Error {
51
51
  */
52
52
  declare const formatWorkflowError: (error: unknown) => FailureFunctionPayload;
53
53
 
54
- export { ChatRateLimit, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, QstashWorkflowAbort, QstashWorkflowError, RateLimit, formatWorkflowError };
54
+ export { ChatRateLimit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, RateLimit, formatWorkflowError };
package/index.js CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
 
20
20
 
21
- var _chunkITPUDOLSjs = require('./chunk-ITPUDOLS.js');
21
+ var _chunkNYJWM6N6js = require('./chunk-NYJWM6N6.js');
22
22
 
23
23
 
24
24
 
@@ -38,4 +38,4 @@ var _chunkITPUDOLSjs = require('./chunk-ITPUDOLS.js');
38
38
 
39
39
 
40
40
 
41
- exports.Chat = _chunkITPUDOLSjs.Chat; exports.Client = _chunkITPUDOLSjs.Client; exports.Messages = _chunkITPUDOLSjs.Messages; exports.QstashChatRatelimitError = _chunkITPUDOLSjs.QstashChatRatelimitError; exports.QstashDailyRatelimitError = _chunkITPUDOLSjs.QstashDailyRatelimitError; exports.QstashError = _chunkITPUDOLSjs.QstashError; exports.QstashRatelimitError = _chunkITPUDOLSjs.QstashRatelimitError; exports.QstashWorkflowAbort = _chunkITPUDOLSjs.QstashWorkflowAbort; exports.QstashWorkflowError = _chunkITPUDOLSjs.QstashWorkflowError; exports.Receiver = _chunkITPUDOLSjs.Receiver; exports.Schedules = _chunkITPUDOLSjs.Schedules; exports.SignatureError = _chunkITPUDOLSjs.SignatureError; exports.UrlGroups = _chunkITPUDOLSjs.UrlGroups; exports.custom = _chunkITPUDOLSjs.custom; exports.formatWorkflowError = _chunkITPUDOLSjs.formatWorkflowError; exports.openai = _chunkITPUDOLSjs.openai; exports.setupAnalytics = _chunkITPUDOLSjs.setupAnalytics; exports.upstash = _chunkITPUDOLSjs.upstash;
41
+ exports.Chat = _chunkNYJWM6N6js.Chat; exports.Client = _chunkNYJWM6N6js.Client; exports.Messages = _chunkNYJWM6N6js.Messages; exports.QStashWorkflowAbort = _chunkNYJWM6N6js.QStashWorkflowAbort; exports.QStashWorkflowError = _chunkNYJWM6N6js.QStashWorkflowError; exports.QstashChatRatelimitError = _chunkNYJWM6N6js.QstashChatRatelimitError; exports.QstashDailyRatelimitError = _chunkNYJWM6N6js.QstashDailyRatelimitError; exports.QstashError = _chunkNYJWM6N6js.QstashError; exports.QstashRatelimitError = _chunkNYJWM6N6js.QstashRatelimitError; exports.Receiver = _chunkNYJWM6N6js.Receiver; exports.Schedules = _chunkNYJWM6N6js.Schedules; exports.SignatureError = _chunkNYJWM6N6js.SignatureError; exports.UrlGroups = _chunkNYJWM6N6js.UrlGroups; exports.custom = _chunkNYJWM6N6js.custom; exports.formatWorkflowError = _chunkNYJWM6N6js.formatWorkflowError; exports.openai = _chunkNYJWM6N6js.openai; exports.setupAnalytics = _chunkNYJWM6N6js.setupAnalytics; exports.upstash = _chunkNYJWM6N6js.upstash;
package/index.mjs CHANGED
@@ -3,12 +3,12 @@ import {
3
3
  Chat,
4
4
  Client,
5
5
  Messages,
6
+ QStashWorkflowAbort,
7
+ QStashWorkflowError,
6
8
  QstashChatRatelimitError,
7
9
  QstashDailyRatelimitError,
8
10
  QstashError,
9
11
  QstashRatelimitError,
10
- QstashWorkflowAbort,
11
- QstashWorkflowError,
12
12
  Receiver,
13
13
  Schedules,
14
14
  SignatureError,
@@ -18,17 +18,17 @@ import {
18
18
  openai,
19
19
  setupAnalytics,
20
20
  upstash
21
- } from "./chunk-SFGYSWJI.mjs";
21
+ } from "./chunk-M4XG6QUQ.mjs";
22
22
  export {
23
23
  Chat,
24
24
  Client,
25
25
  Messages,
26
+ QStashWorkflowAbort,
27
+ QStashWorkflowError,
26
28
  QstashChatRatelimitError,
27
29
  QstashDailyRatelimitError,
28
30
  QstashError,
29
31
  QstashRatelimitError,
30
- QstashWorkflowAbort,
31
- QstashWorkflowError,
32
32
  Receiver,
33
33
  Schedules,
34
34
  SignatureError,
package/nextjs.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NextApiHandler } from 'next';
2
2
  import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
3
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-BBvt1wQq.mjs';
3
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-CMBMVtW3.mjs';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
package/nextjs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NextApiHandler } from 'next';
2
2
  import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
3
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-BBvt1wQq.js';
3
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-CMBMVtW3.js';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
package/nextjs.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkITPUDOLSjs = require('./chunk-ITPUDOLS.js');
5
+ var _chunkNYJWM6N6js = require('./chunk-NYJWM6N6.js');
6
6
 
7
7
  // platforms/nextjs.ts
8
8
  var _server = require('next/server');
@@ -20,7 +20,7 @@ function verifySignature(handler, config) {
20
20
  "nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
21
21
  );
22
22
  }
23
- const receiver = new (0, _chunkITPUDOLSjs.Receiver)({
23
+ const receiver = new (0, _chunkNYJWM6N6js.Receiver)({
24
24
  currentSigningKey,
25
25
  nextSigningKey
26
26
  });
@@ -72,7 +72,7 @@ function verifySignatureEdge(handler, config) {
72
72
  "nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
73
73
  );
74
74
  }
75
- const receiver = new (0, _chunkITPUDOLSjs.Receiver)({
75
+ const receiver = new (0, _chunkNYJWM6N6js.Receiver)({
76
76
  currentSigningKey,
77
77
  nextSigningKey
78
78
  });
@@ -112,7 +112,7 @@ function verifySignatureAppRouter(handler, config) {
112
112
  "nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
113
113
  );
114
114
  }
115
- const receiver = new (0, _chunkITPUDOLSjs.Receiver)({
115
+ const receiver = new (0, _chunkNYJWM6N6js.Receiver)({
116
116
  currentSigningKey,
117
117
  nextSigningKey
118
118
  });
@@ -140,7 +140,7 @@ function verifySignatureAppRouter(handler, config) {
140
140
  };
141
141
  }
142
142
  var serve2 = (routeFunction, options) => {
143
- const handler = _chunkITPUDOLSjs.serve.call(void 0, routeFunction, {
143
+ const handler = _chunkNYJWM6N6js.serve.call(void 0, routeFunction, {
144
144
  onStepFinish: (workflowRunId) => new (0, _server.NextResponse)(JSON.stringify({ workflowRunId }), { status: 200 }),
145
145
  ...options
146
146
  });
@@ -149,7 +149,7 @@ var serve2 = (routeFunction, options) => {
149
149
  return await handler(request);
150
150
  } catch (error) {
151
151
  console.error(error);
152
- return new (0, _server.NextResponse)(JSON.stringify(_chunkITPUDOLSjs.formatWorkflowError.call(void 0, error)), {
152
+ return new (0, _server.NextResponse)(JSON.stringify(_chunkNYJWM6N6js.formatWorkflowError.call(void 0, error)), {
153
153
  status: 500
154
154
  });
155
155
  }
package/nextjs.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  Receiver,
3
3
  formatWorkflowError,
4
4
  serve
5
- } from "./chunk-SFGYSWJI.mjs";
5
+ } from "./chunk-M4XG6QUQ.mjs";
6
6
 
7
7
  // platforms/nextjs.ts
8
8
  import { NextResponse } from "next/server";
package/nuxt.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as h3 from 'h3';
2
2
  import { H3Event } from 'h3';
3
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-BBvt1wQq.mjs';
3
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-CMBMVtW3.mjs';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
package/nuxt.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as h3 from 'h3';
2
2
  import { H3Event } from 'h3';
3
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-BBvt1wQq.js';
3
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-CMBMVtW3.js';
4
4
  import 'neverthrow';
5
5
 
6
6
  type VerifySignatureConfig = {
package/nuxt.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkITPUDOLSjs = require('./chunk-ITPUDOLS.js');
6
+ var _chunkNYJWM6N6js = require('./chunk-NYJWM6N6.js');
7
7
 
8
8
  // platforms/nuxt.ts
9
9
  var _h3 = require('h3');
@@ -20,7 +20,7 @@ var verifySignatureNuxt = (handler, config) => {
20
20
  "nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
21
21
  );
22
22
  }
23
- const receiver = new (0, _chunkITPUDOLSjs.Receiver)({
23
+ const receiver = new (0, _chunkNYJWM6N6js.Receiver)({
24
24
  currentSigningKey,
25
25
  nextSigningKey
26
26
  });
@@ -71,12 +71,12 @@ var serve2 = (routeFunction, options) => {
71
71
  body: await _h3.readRawBody.call(void 0, event),
72
72
  method: "POST"
73
73
  });
74
- const serveHandler = _chunkITPUDOLSjs.serve.call(void 0, routeFunction, options);
74
+ const serveHandler = _chunkNYJWM6N6js.serve.call(void 0, routeFunction, options);
75
75
  try {
76
76
  return await serveHandler(request);
77
77
  } catch (error) {
78
78
  console.error(error);
79
- return new Response(JSON.stringify(_chunkITPUDOLSjs.formatWorkflowError.call(void 0, error)), { status: 500 });
79
+ return new Response(JSON.stringify(_chunkNYJWM6N6js.formatWorkflowError.call(void 0, error)), { status: 500 });
80
80
  }
81
81
  });
82
82
  return handler;
package/nuxt.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Receiver,
4
4
  formatWorkflowError,
5
5
  serve
6
- } from "./chunk-SFGYSWJI.mjs";
6
+ } from "./chunk-M4XG6QUQ.mjs";
7
7
 
8
8
  // platforms/nuxt.ts
9
9
  import { defineEventHandler, getHeader, readRawBody } from "h3";
package/package.json CHANGED
@@ -1 +1 @@
1
- {"version":"v2.7.0-workflow-alpha.2","name":"@upstash/qstash","description":"Official Typescript client for QStash","author":"Andreas Thomas <dev@chronark.com>","license":"MIT","homepage":"https://github.com/upstash/sdk-qstash-ts#readme","repository":{"type":"git","url":"git+https://github.com/upstash/sdk-qstash-ts.git"},"bugs":{"url":"https://github.com/upstash/sdk-qstash-ts/issues"},"main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./**"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./nextjs":{"import":"./nextjs.js","require":"./nextjs.js"},"./dist/nextjs":{"import":"./nextjs.js","require":"./nextjs.js"},"./nuxt":{"types":"./nuxt.d.ts","import":"./nuxt.mjs","require":"./nuxt.js"},"./svelte":{"types":"./svelte.d.ts","import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"types":"./solidjs.d.ts","import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"types":"./workflow.d.ts","import":"./workflow.mjs","require":"./workflow.js"}},"typesVersions":{"*":{"nextjs":["./nextjs.d.ts"]}},"keywords":["qstash","queue","events","serverless","upstash"],"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test","fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix"},"devDependencies":{"@commitlint/cli":"^19.2.2","@commitlint/config-conventional":"^19.2.2","@types/bun":"^1.1.1","@types/crypto-js":"^4.2.0","@typescript-eslint/eslint-plugin":"^7.0.1","@typescript-eslint/parser":"^7.0.1","ai":"^3.1.28","bun-types":"^1.1.7","eslint":"^8","eslint-plugin-unicorn":"^51.0.1","husky":"^9.0.10","neverthrow":"^7.0.1","next":"^14.0.2","prettier":"^3.2.5","tsup":"latest","typescript":"^5.4.5","undici-types":"^6.16.0","vitest":"latest"},"dependencies":{"@solidjs/start":"^1.0.6","@sveltejs/kit":"^2.5.18","crypto-js":">=4.2.0","h3":"^1.12.0","jose":"^ 5.2.3"}}
1
+ {"version":"v2.7.0-workflow-alpha.3","name":"@upstash/qstash","description":"Official Typescript client for QStash","author":"Andreas Thomas <dev@chronark.com>","license":"MIT","homepage":"https://github.com/upstash/sdk-qstash-ts#readme","repository":{"type":"git","url":"git+https://github.com/upstash/sdk-qstash-ts.git"},"bugs":{"url":"https://github.com/upstash/sdk-qstash-ts/issues"},"main":"./index.js","module":"./index.mjs","types":"./index.d.ts","files":["./**"],"exports":{".":{"import":"./index.mjs","require":"./index.js"},"./nextjs":{"import":"./nextjs.js","require":"./nextjs.js"},"./dist/nextjs":{"import":"./nextjs.js","require":"./nextjs.js"},"./nuxt":{"types":"./nuxt.d.ts","import":"./nuxt.mjs","require":"./nuxt.js"},"./svelte":{"types":"./svelte.d.ts","import":"./svelte.mjs","require":"./svelte.js"},"./solidjs":{"types":"./solidjs.d.ts","import":"./solidjs.mjs","require":"./solidjs.js"},"./workflow":{"types":"./workflow.d.ts","import":"./workflow.mjs","require":"./workflow.js"}},"typesVersions":{"*":{"nextjs":["./nextjs.d.ts"]}},"keywords":["qstash","queue","events","serverless","upstash"],"scripts":{"build":"tsup && cp README.md ./dist/ && cp package.json ./dist/ && cp LICENSE ./dist/","test":"bun test","fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix"},"devDependencies":{"@commitlint/cli":"^19.2.2","@commitlint/config-conventional":"^19.2.2","@types/bun":"^1.1.1","@types/crypto-js":"^4.2.0","@typescript-eslint/eslint-plugin":"^7.0.1","@typescript-eslint/parser":"^7.0.1","ai":"^3.1.28","bun-types":"^1.1.7","eslint":"^8","eslint-plugin-unicorn":"^51.0.1","husky":"^9.0.10","neverthrow":"^7.0.1","next":"^14.0.2","prettier":"^3.2.5","tsup":"latest","typescript":"^5.4.5","undici-types":"^6.16.0","vitest":"latest"},"dependencies":{"@solidjs/start":"^1.0.6","@sveltejs/kit":"^2.5.18","crypto-js":">=4.2.0","h3":"^1.12.0","jose":"^ 5.2.3"}}
package/solidjs.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { APIHandler, APIEvent } from '@solidjs/start/server';
2
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-BBvt1wQq.mjs';
2
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-CMBMVtW3.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
package/solidjs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { APIHandler, APIEvent } from '@solidjs/start/server';
2
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-BBvt1wQq.js';
2
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-CMBMVtW3.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
package/solidjs.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkITPUDOLSjs = require('./chunk-ITPUDOLS.js');
6
+ var _chunkNYJWM6N6js = require('./chunk-NYJWM6N6.js');
7
7
 
8
8
  // platforms/solidjs.ts
9
9
  var verifySignatureSolidjs = (handler, config) => {
@@ -15,7 +15,7 @@ var verifySignatureSolidjs = (handler, config) => {
15
15
  if (!nextSigningKey) {
16
16
  throw new Error("nextSigningKey is required, either in the config or from the env");
17
17
  }
18
- const receiver = new (0, _chunkITPUDOLSjs.Receiver)({
18
+ const receiver = new (0, _chunkNYJWM6N6js.Receiver)({
19
19
  currentSigningKey,
20
20
  nextSigningKey
21
21
  });
@@ -46,13 +46,13 @@ var serve2 = (routeFunction, options) => {
46
46
  if (method.toUpperCase() !== "POST") {
47
47
  return new Response("Only POST requests are allowed in worklfows", { status: 405 });
48
48
  }
49
- const serveHandler = _chunkITPUDOLSjs.serve.call(void 0, routeFunction, options);
49
+ const serveHandler = _chunkNYJWM6N6js.serve.call(void 0, routeFunction, options);
50
50
  try {
51
51
  const result = await serveHandler(event.request);
52
52
  return result;
53
53
  } catch (error) {
54
54
  console.error(error);
55
- return new Response(JSON.stringify(_chunkITPUDOLSjs.formatWorkflowError.call(void 0, error)), { status: 500 });
55
+ return new Response(JSON.stringify(_chunkNYJWM6N6js.formatWorkflowError.call(void 0, error)), { status: 500 });
56
56
  }
57
57
  };
58
58
  return handler;
package/solidjs.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Receiver,
4
4
  formatWorkflowError,
5
5
  serve
6
- } from "./chunk-SFGYSWJI.mjs";
6
+ } from "./chunk-M4XG6QUQ.mjs";
7
7
 
8
8
  // platforms/solidjs.ts
9
9
  var verifySignatureSolidjs = (handler, config) => {
package/svelte.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from '@sveltejs/kit';
2
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-BBvt1wQq.mjs';
2
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-CMBMVtW3.mjs';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
package/svelte.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RequestHandler } from '@sveltejs/kit';
2
- import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-BBvt1wQq.js';
2
+ import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-CMBMVtW3.js';
3
3
  import 'neverthrow';
4
4
 
5
5
  type VerifySignatureConfig = {
package/svelte.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkITPUDOLSjs = require('./chunk-ITPUDOLS.js');
6
+ var _chunkNYJWM6N6js = require('./chunk-NYJWM6N6.js');
7
7
 
8
8
  // platforms/svelte.ts
9
9
  var verifySignatureSvelte = (handler, config) => {
@@ -15,7 +15,7 @@ var verifySignatureSvelte = (handler, config) => {
15
15
  if (!nextSigningKey) {
16
16
  throw new Error("nextSigningKey is required, either in the config or from the env");
17
17
  }
18
- const receiver = new (0, _chunkITPUDOLSjs.Receiver)({
18
+ const receiver = new (0, _chunkNYJWM6N6js.Receiver)({
19
19
  currentSigningKey,
20
20
  nextSigningKey
21
21
  });
@@ -43,7 +43,7 @@ var verifySignatureSvelte = (handler, config) => {
43
43
  };
44
44
  var serve2 = (routeFunction, qstashClient, options) => {
45
45
  const handler = async ({ request }) => {
46
- const serveMethod = _chunkITPUDOLSjs.serve.call(void 0, routeFunction, {
46
+ const serveMethod = _chunkNYJWM6N6js.serve.call(void 0, routeFunction, {
47
47
  qstashClient,
48
48
  ...options
49
49
  });
@@ -51,7 +51,7 @@ var serve2 = (routeFunction, qstashClient, options) => {
51
51
  return await serveMethod(request);
52
52
  } catch (error) {
53
53
  console.error(error);
54
- return new Response(JSON.stringify(_chunkITPUDOLSjs.formatWorkflowError.call(void 0, error)), { status: 500 });
54
+ return new Response(JSON.stringify(_chunkNYJWM6N6js.formatWorkflowError.call(void 0, error)), { status: 500 });
55
55
  }
56
56
  };
57
57
  return handler;
package/svelte.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Receiver,
4
4
  formatWorkflowError,
5
5
  serve
6
- } from "./chunk-SFGYSWJI.mjs";
6
+ } from "./chunk-M4XG6QUQ.mjs";
7
7
 
8
8
  // platforms/svelte.ts
9
9
  var verifySignatureSvelte = (handler, config) => {
package/workflow.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export { ad as AsyncStepFunction, a8 as DisabledWorkflowContext, F as FailureFunctionPayload, ag as FinishCondition, ai as LogLevel, af as ParallelCallState, ab as RawStep, ah as RequiredExceptFields, a2 as RouteFunction, S as Step, ae as StepFunction, aa as StepType, a9 as StepTypes, ac as SyncStepFunction, a4 as Workflow, a7 as WorkflowContext, ak as WorkflowLogger, aj as WorkflowLoggerOptions, a3 as WorkflowServeOptions, a5 as processOptions, a6 as serve } from './client-BBvt1wQq.mjs';
1
+ export { af as AsyncStepFunction, a8 as DisabledWorkflowContext, F as FailureFunctionPayload, ai as FinishCondition, ak as LogLevel, ah as ParallelCallState, ad as RawStep, aj as RequiredExceptFields, a2 as RouteFunction, S as Step, ag as StepFunction, ac as StepType, ab as StepTypes, ae as SyncStepFunction, a4 as Workflow, a9 as WorkflowClient, a7 as WorkflowContext, am as WorkflowLogger, al as WorkflowLoggerOptions, aa as WorkflowReceiver, a3 as WorkflowServeOptions, a5 as processOptions, a6 as serve } from './client-CMBMVtW3.mjs';
2
2
  import 'neverthrow';
package/workflow.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { ad as AsyncStepFunction, a8 as DisabledWorkflowContext, F as FailureFunctionPayload, ag as FinishCondition, ai as LogLevel, af as ParallelCallState, ab as RawStep, ah as RequiredExceptFields, a2 as RouteFunction, S as Step, ae as StepFunction, aa as StepType, a9 as StepTypes, ac as SyncStepFunction, a4 as Workflow, a7 as WorkflowContext, ak as WorkflowLogger, aj as WorkflowLoggerOptions, a3 as WorkflowServeOptions, a5 as processOptions, a6 as serve } from './client-BBvt1wQq.js';
1
+ export { af as AsyncStepFunction, a8 as DisabledWorkflowContext, F as FailureFunctionPayload, ai as FinishCondition, ak as LogLevel, ah as ParallelCallState, ad as RawStep, aj as RequiredExceptFields, a2 as RouteFunction, S as Step, ag as StepFunction, ac as StepType, ab as StepTypes, ae as SyncStepFunction, a4 as Workflow, a9 as WorkflowClient, a7 as WorkflowContext, am as WorkflowLogger, al as WorkflowLoggerOptions, aa as WorkflowReceiver, a3 as WorkflowServeOptions, a5 as processOptions, a6 as serve } from './client-CMBMVtW3.js';
2
2
  import 'neverthrow';
package/workflow.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkITPUDOLSjs = require('./chunk-ITPUDOLS.js');
9
+ var _chunkNYJWM6N6js = require('./chunk-NYJWM6N6.js');
10
10
 
11
11
 
12
12
 
@@ -15,4 +15,4 @@ var _chunkITPUDOLSjs = require('./chunk-ITPUDOLS.js');
15
15
 
16
16
 
17
17
 
18
- exports.DisabledWorkflowContext = _chunkITPUDOLSjs.DisabledWorkflowContext; exports.StepTypes = _chunkITPUDOLSjs.StepTypes; exports.Workflow = _chunkITPUDOLSjs.Workflow; exports.WorkflowContext = _chunkITPUDOLSjs.WorkflowContext; exports.WorkflowLogger = _chunkITPUDOLSjs.WorkflowLogger; exports.processOptions = _chunkITPUDOLSjs.processOptions; exports.serve = _chunkITPUDOLSjs.serve;
18
+ exports.DisabledWorkflowContext = _chunkNYJWM6N6js.DisabledWorkflowContext; exports.StepTypes = _chunkNYJWM6N6js.StepTypes; exports.Workflow = _chunkNYJWM6N6js.Workflow; exports.WorkflowContext = _chunkNYJWM6N6js.WorkflowContext; exports.WorkflowLogger = _chunkNYJWM6N6js.WorkflowLogger; exports.processOptions = _chunkNYJWM6N6js.processOptions; exports.serve = _chunkNYJWM6N6js.serve;
package/workflow.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  WorkflowLogger,
7
7
  processOptions,
8
8
  serve
9
- } from "./chunk-SFGYSWJI.mjs";
9
+ } from "./chunk-M4XG6QUQ.mjs";
10
10
  export {
11
11
  DisabledWorkflowContext,
12
12
  StepTypes,