@upstash/workflow 0.2.12 → 0.2.13

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/hono.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SDK_TELEMETRY,
3
3
  serveBase,
4
4
  serveManyBase
5
- } from "./chunk-4GTHIL7S.mjs";
5
+ } from "./chunk-XVNSBBDC.mjs";
6
6
 
7
7
  // platforms/hono.ts
8
8
  var telemetry = {
@@ -11,7 +11,7 @@ var telemetry = {
11
11
  };
12
12
  var serve = (routeFunction, options) => {
13
13
  const handler = async (context) => {
14
- const environment = context.env;
14
+ const environment = context.env ? context.env : typeof process === "undefined" ? {} : process.env;
15
15
  const request = context.req.raw;
16
16
  const { handler: serveHandler } = serveBase(routeFunction, telemetry, {
17
17
  // when hono is used without cf workers, it sends a DebugHTTPServer
package/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { R as RouteFunction, W as WorkflowServeOptions, E as ExclusiveValidationOptions, T as Telemetry, S as StepType, a as RawStep, N as NotifyResponse, b as Waiter, c as Step } from './types-D1W0VOpy.mjs';
2
- export { A as AsyncStepFunction, C as CallResponse, r as CallSettings, D as Duration, l as FailureFunctionPayload, F as FinishCondition, H as HeaderParams, t as InvokableWorkflow, s as InvokeStepResponse, I as InvokeWorkflowRequest, L as LazyInvokeStepParams, u as LogLevel, p as NotifyStepResponse, P as ParallelCallState, k as PublicServeOptions, m as RequiredExceptFields, j as StepFunction, h as StepTypes, i as SyncStepFunction, q as WaitEventOptions, n as WaitRequest, o as WaitStepResponse, f as WorkflowClient, e as WorkflowContext, w as WorkflowLogger, v as WorkflowLoggerOptions, g as WorkflowReceiver, d as WorkflowTool } from './types-D1W0VOpy.mjs';
3
- import { HTTPMethods, State, FlowControl, Client as Client$1, QstashError } from '@upstash/qstash';
1
+ import { R as RouteFunction, W as WorkflowServeOptions, E as ExclusiveValidationOptions, T as Telemetry, S as StepType, a as RawStep, N as NotifyResponse, b as Waiter, c as Step } from './types-C1WIgVLA.mjs';
2
+ export { A as AsyncStepFunction, C as CallResponse, r as CallSettings, D as Duration, l as FailureFunctionPayload, F as FinishCondition, H as HeaderParams, t as InvokableWorkflow, s as InvokeStepResponse, I as InvokeWorkflowRequest, L as LazyInvokeStepParams, u as LogLevel, p as NotifyStepResponse, P as ParallelCallState, k as PublicServeOptions, m as RequiredExceptFields, j as StepFunction, h as StepTypes, i as SyncStepFunction, q as WaitEventOptions, n as WaitRequest, o as WaitStepResponse, f as WorkflowClient, e as WorkflowContext, w as WorkflowLogger, v as WorkflowLoggerOptions, g as WorkflowReceiver, d as WorkflowTool } from './types-C1WIgVLA.mjs';
3
+ import { HTTPMethods, State, FlowControl, PublishRequest, Client as Client$1, QstashError } from '@upstash/qstash';
4
4
  import 'zod';
5
5
  import 'ai';
6
6
  import '@ai-sdk/openai';
@@ -423,15 +423,21 @@ declare class Client {
423
423
  * with `wfr_`.
424
424
  * @param retries retry to use in the initial request. in the rest of
425
425
  * the workflow, `retries` option of the `serve` will be used.
426
+ * @param flowControl Settings for controlling the number of active requests
427
+ * and number of requests per second with the same key.
428
+ * @param delay Delay for the workflow run. This is used to delay the
429
+ * execution of the workflow run. The delay is in seconds or can be passed
430
+ * as a string with a time unit (e.g. "1h", "30m", "15s").
426
431
  * @returns workflow run id
427
432
  */
428
- trigger({ url, body, headers, workflowRunId, retries, flowControl, }: {
433
+ trigger({ url, body, headers, workflowRunId, retries, flowControl, delay, }: {
429
434
  url: string;
430
435
  body?: unknown;
431
436
  headers?: Record<string, string>;
432
437
  workflowRunId?: string;
433
438
  retries?: number;
434
439
  flowControl?: FlowControl;
440
+ delay?: PublishRequest["delay"];
435
441
  }): Promise<{
436
442
  workflowRunId: string;
437
443
  }>;
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { R as RouteFunction, W as WorkflowServeOptions, E as ExclusiveValidationOptions, T as Telemetry, S as StepType, a as RawStep, N as NotifyResponse, b as Waiter, c as Step } from './types-D1W0VOpy.js';
2
- export { A as AsyncStepFunction, C as CallResponse, r as CallSettings, D as Duration, l as FailureFunctionPayload, F as FinishCondition, H as HeaderParams, t as InvokableWorkflow, s as InvokeStepResponse, I as InvokeWorkflowRequest, L as LazyInvokeStepParams, u as LogLevel, p as NotifyStepResponse, P as ParallelCallState, k as PublicServeOptions, m as RequiredExceptFields, j as StepFunction, h as StepTypes, i as SyncStepFunction, q as WaitEventOptions, n as WaitRequest, o as WaitStepResponse, f as WorkflowClient, e as WorkflowContext, w as WorkflowLogger, v as WorkflowLoggerOptions, g as WorkflowReceiver, d as WorkflowTool } from './types-D1W0VOpy.js';
3
- import { HTTPMethods, State, FlowControl, Client as Client$1, QstashError } from '@upstash/qstash';
1
+ import { R as RouteFunction, W as WorkflowServeOptions, E as ExclusiveValidationOptions, T as Telemetry, S as StepType, a as RawStep, N as NotifyResponse, b as Waiter, c as Step } from './types-C1WIgVLA.js';
2
+ export { A as AsyncStepFunction, C as CallResponse, r as CallSettings, D as Duration, l as FailureFunctionPayload, F as FinishCondition, H as HeaderParams, t as InvokableWorkflow, s as InvokeStepResponse, I as InvokeWorkflowRequest, L as LazyInvokeStepParams, u as LogLevel, p as NotifyStepResponse, P as ParallelCallState, k as PublicServeOptions, m as RequiredExceptFields, j as StepFunction, h as StepTypes, i as SyncStepFunction, q as WaitEventOptions, n as WaitRequest, o as WaitStepResponse, f as WorkflowClient, e as WorkflowContext, w as WorkflowLogger, v as WorkflowLoggerOptions, g as WorkflowReceiver, d as WorkflowTool } from './types-C1WIgVLA.js';
3
+ import { HTTPMethods, State, FlowControl, PublishRequest, Client as Client$1, QstashError } from '@upstash/qstash';
4
4
  import 'zod';
5
5
  import 'ai';
6
6
  import '@ai-sdk/openai';
@@ -423,15 +423,21 @@ declare class Client {
423
423
  * with `wfr_`.
424
424
  * @param retries retry to use in the initial request. in the rest of
425
425
  * the workflow, `retries` option of the `serve` will be used.
426
+ * @param flowControl Settings for controlling the number of active requests
427
+ * and number of requests per second with the same key.
428
+ * @param delay Delay for the workflow run. This is used to delay the
429
+ * execution of the workflow run. The delay is in seconds or can be passed
430
+ * as a string with a time unit (e.g. "1h", "30m", "15s").
426
431
  * @returns workflow run id
427
432
  */
428
- trigger({ url, body, headers, workflowRunId, retries, flowControl, }: {
433
+ trigger({ url, body, headers, workflowRunId, retries, flowControl, delay, }: {
429
434
  url: string;
430
435
  body?: unknown;
431
436
  headers?: Record<string, string>;
432
437
  workflowRunId?: string;
433
438
  retries?: number;
434
439
  flowControl?: FlowControl;
440
+ delay?: PublishRequest["delay"];
435
441
  }): Promise<{
436
442
  workflowRunId: string;
437
443
  }>;