@upstash/workflow 0.1.0 → 0.1.1-canary-2

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.
@@ -1084,6 +1084,23 @@ var sortSteps = (steps) => {
1084
1084
  return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1085
1085
  };
1086
1086
 
1087
+ // src/client/utils.ts
1088
+ var makeNotifyRequest = async (requester, eventId, eventData) => {
1089
+ const result = await requester.request({
1090
+ path: ["v2", "notify", eventId],
1091
+ method: "POST",
1092
+ body: typeof eventData === "string" ? eventData : JSON.stringify(eventData)
1093
+ });
1094
+ return result;
1095
+ };
1096
+ var makeGetWaitersRequest = async (requester, eventId) => {
1097
+ const result = await requester.request({
1098
+ path: ["v2", "waiters", eventId],
1099
+ method: "GET"
1100
+ });
1101
+ return result;
1102
+ };
1103
+
1087
1104
  // src/context/steps.ts
1088
1105
  var BaseLazyStep = class {
1089
1106
  stepName;
@@ -1242,6 +1259,19 @@ var LazyWaitForEventStep = class extends BaseLazyStep {
1242
1259
  });
1243
1260
  }
1244
1261
  };
1262
+ var LazyNotifyStep = class extends LazyFunctionStep {
1263
+ stepType = "Notify";
1264
+ constructor(stepName, eventId, eventData, requester) {
1265
+ super(stepName, async () => {
1266
+ const notifyResponse = await makeNotifyRequest(requester, eventId, eventData);
1267
+ return {
1268
+ eventId,
1269
+ eventData,
1270
+ notifyResponse
1271
+ };
1272
+ });
1273
+ }
1274
+ };
1245
1275
 
1246
1276
  // src/context/context.ts
1247
1277
  var WorkflowContext = class {
@@ -1488,6 +1518,38 @@ var WorkflowContext = class {
1488
1518
  return result;
1489
1519
  }
1490
1520
  }
1521
+ /**
1522
+ * Makes the workflow run wait until a notify request is sent or until the
1523
+ * timeout ends
1524
+ *
1525
+ * ```ts
1526
+ * const { eventData, timeout } = await context.waitForEvent(
1527
+ * "wait for event step",
1528
+ * "my-event-id",
1529
+ * 100 // timeout after 100 seconds
1530
+ * );
1531
+ * ```
1532
+ *
1533
+ * To notify a waiting workflow run, you can use the notify method:
1534
+ *
1535
+ * ```ts
1536
+ * import { Client } from "@upstash/workflow";
1537
+ *
1538
+ * const client = new Client({ token: });
1539
+ *
1540
+ * await client.notify({
1541
+ * eventId: "my-event-id",
1542
+ * eventData: "eventData"
1543
+ * })
1544
+ * ```
1545
+ *
1546
+ * @param stepName
1547
+ * @param eventId event id to wake up the waiting workflow run
1548
+ * @param timeout timeout duration in seconds
1549
+ * @returns wait response as `{ timeout: boolean, eventData: unknown }`.
1550
+ * timeout is true if the wait times out, if notified it is false. eventData
1551
+ * is the value passed to `client.notify`.
1552
+ */
1491
1553
  async waitForEvent(stepName, eventId, timeout) {
1492
1554
  const result = await this.addStep(
1493
1555
  new LazyWaitForEventStep(
@@ -1496,7 +1558,27 @@ var WorkflowContext = class {
1496
1558
  typeof timeout === "string" ? timeout : `${timeout}s`
1497
1559
  )
1498
1560
  );
1499
- return result;
1561
+ try {
1562
+ return {
1563
+ ...result,
1564
+ eventData: JSON.parse(result.eventData)
1565
+ };
1566
+ } catch {
1567
+ return result;
1568
+ }
1569
+ }
1570
+ async notify(stepName, eventId, eventData) {
1571
+ const result = await this.addStep(
1572
+ new LazyNotifyStep(stepName, eventId, eventData, this.qstashClient.http)
1573
+ );
1574
+ try {
1575
+ return {
1576
+ ...result,
1577
+ eventData: JSON.parse(result.eventData)
1578
+ };
1579
+ } catch {
1580
+ return result;
1581
+ }
1500
1582
  }
1501
1583
  /**
1502
1584
  * Adds steps to the executor. Needed so that it can be overwritten in
@@ -1597,7 +1679,7 @@ var parsePayload = (rawPayload) => {
1597
1679
  const step = JSON.parse(decodeBase64(rawStep.body));
1598
1680
  if (step.waitEventId) {
1599
1681
  const newOut = {
1600
- notifyBody: step.out,
1682
+ eventData: step.out,
1601
1683
  timeout: step.waitTimeout ?? false
1602
1684
  };
1603
1685
  step.out = newOut;
@@ -1957,7 +2039,7 @@ import { Client as QStashClient } from "@upstash/qstash";
1957
2039
  var Client3 = class {
1958
2040
  client;
1959
2041
  constructor(clientConfig) {
1960
- if (!clientConfig.baseUrl || !clientConfig.token) {
2042
+ if (!clientConfig.token) {
1961
2043
  console.warn("[Upstash Workflow] url or the token is not set. client will not work.");
1962
2044
  }
1963
2045
  this.client = new QStashClient(clientConfig);
@@ -1980,18 +2062,21 @@ var Client3 = class {
1980
2062
  * Notify a workflow run waiting for an event
1981
2063
  *
1982
2064
  * @param eventId event id to notify
1983
- * @param notifyData data to provide to the workflow
2065
+ * @param eventData data to provide to the workflow
1984
2066
  */
1985
2067
  async notify({
1986
2068
  eventId,
1987
- notifyBody
2069
+ eventData
1988
2070
  }) {
1989
- const result = await this.client.http.request({
1990
- path: ["v2", "notify", eventId],
1991
- method: "POST",
1992
- body: notifyBody
1993
- });
1994
- return result;
2071
+ return await makeNotifyRequest(this.client.http, eventId, eventData);
2072
+ }
2073
+ /**
2074
+ * Check waiters of an event
2075
+ *
2076
+ * @param eventId event id to check
2077
+ */
2078
+ async getWaiters({ eventId }) {
2079
+ return await makeGetWaitersRequest(this.client.http, eventId);
1995
2080
  }
1996
2081
  };
1997
2082
 
package/cloudflare.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RouteFunction, W as WorkflowServeOptions } from './types-CfN1Epuj.mjs';
1
+ import { R as RouteFunction, W as WorkflowServeOptions } from './types-CoXaNrxX.mjs';
2
2
  import '@upstash/qstash';
3
3
 
4
4
  type WorkflowBindings = {
package/cloudflare.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RouteFunction, W as WorkflowServeOptions } from './types-CfN1Epuj.js';
1
+ import { R as RouteFunction, W as WorkflowServeOptions } from './types-CoXaNrxX.js';
2
2
  import '@upstash/qstash';
3
3
 
4
4
  type WorkflowBindings = {
package/cloudflare.js CHANGED
@@ -1110,6 +1110,16 @@ var sortSteps = (steps) => {
1110
1110
  return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1111
1111
  };
1112
1112
 
1113
+ // src/client/utils.ts
1114
+ var makeNotifyRequest = async (requester, eventId, eventData) => {
1115
+ const result = await requester.request({
1116
+ path: ["v2", "notify", eventId],
1117
+ method: "POST",
1118
+ body: typeof eventData === "string" ? eventData : JSON.stringify(eventData)
1119
+ });
1120
+ return result;
1121
+ };
1122
+
1113
1123
  // src/context/steps.ts
1114
1124
  var BaseLazyStep = class {
1115
1125
  stepName;
@@ -1268,6 +1278,19 @@ var LazyWaitForEventStep = class extends BaseLazyStep {
1268
1278
  });
1269
1279
  }
1270
1280
  };
1281
+ var LazyNotifyStep = class extends LazyFunctionStep {
1282
+ stepType = "Notify";
1283
+ constructor(stepName, eventId, eventData, requester) {
1284
+ super(stepName, async () => {
1285
+ const notifyResponse = await makeNotifyRequest(requester, eventId, eventData);
1286
+ return {
1287
+ eventId,
1288
+ eventData,
1289
+ notifyResponse
1290
+ };
1291
+ });
1292
+ }
1293
+ };
1271
1294
 
1272
1295
  // src/context/context.ts
1273
1296
  var WorkflowContext = class {
@@ -1514,6 +1537,38 @@ var WorkflowContext = class {
1514
1537
  return result;
1515
1538
  }
1516
1539
  }
1540
+ /**
1541
+ * Makes the workflow run wait until a notify request is sent or until the
1542
+ * timeout ends
1543
+ *
1544
+ * ```ts
1545
+ * const { eventData, timeout } = await context.waitForEvent(
1546
+ * "wait for event step",
1547
+ * "my-event-id",
1548
+ * 100 // timeout after 100 seconds
1549
+ * );
1550
+ * ```
1551
+ *
1552
+ * To notify a waiting workflow run, you can use the notify method:
1553
+ *
1554
+ * ```ts
1555
+ * import { Client } from "@upstash/workflow";
1556
+ *
1557
+ * const client = new Client({ token: });
1558
+ *
1559
+ * await client.notify({
1560
+ * eventId: "my-event-id",
1561
+ * eventData: "eventData"
1562
+ * })
1563
+ * ```
1564
+ *
1565
+ * @param stepName
1566
+ * @param eventId event id to wake up the waiting workflow run
1567
+ * @param timeout timeout duration in seconds
1568
+ * @returns wait response as `{ timeout: boolean, eventData: unknown }`.
1569
+ * timeout is true if the wait times out, if notified it is false. eventData
1570
+ * is the value passed to `client.notify`.
1571
+ */
1517
1572
  async waitForEvent(stepName, eventId, timeout) {
1518
1573
  const result = await this.addStep(
1519
1574
  new LazyWaitForEventStep(
@@ -1522,7 +1577,27 @@ var WorkflowContext = class {
1522
1577
  typeof timeout === "string" ? timeout : `${timeout}s`
1523
1578
  )
1524
1579
  );
1525
- return result;
1580
+ try {
1581
+ return {
1582
+ ...result,
1583
+ eventData: JSON.parse(result.eventData)
1584
+ };
1585
+ } catch {
1586
+ return result;
1587
+ }
1588
+ }
1589
+ async notify(stepName, eventId, eventData) {
1590
+ const result = await this.addStep(
1591
+ new LazyNotifyStep(stepName, eventId, eventData, this.qstashClient.http)
1592
+ );
1593
+ try {
1594
+ return {
1595
+ ...result,
1596
+ eventData: JSON.parse(result.eventData)
1597
+ };
1598
+ } catch {
1599
+ return result;
1600
+ }
1526
1601
  }
1527
1602
  /**
1528
1603
  * Adds steps to the executor. Needed so that it can be overwritten in
@@ -1623,7 +1698,7 @@ var parsePayload = (rawPayload) => {
1623
1698
  const step = JSON.parse(decodeBase64(rawStep.body));
1624
1699
  if (step.waitEventId) {
1625
1700
  const newOut = {
1626
- notifyBody: step.out,
1701
+ eventData: step.out,
1627
1702
  timeout: step.waitTimeout ?? false
1628
1703
  };
1629
1704
  step.out = newOut;
package/cloudflare.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-JDMP6KKR.mjs";
3
+ } from "./chunk-BPN5JBNG.mjs";
4
4
 
5
5
  // platforms/cloudflare.ts
6
6
  var getArgs = (args) => {
package/h3.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as h3 from 'h3';
2
- import { R as RouteFunction, W as WorkflowServeOptions } from './types-CfN1Epuj.mjs';
2
+ import { R as RouteFunction, W as WorkflowServeOptions } from './types-CoXaNrxX.mjs';
3
3
  import '@upstash/qstash';
4
4
 
5
5
  declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => h3.EventHandler<h3.EventHandlerRequest, Promise<Response | {
package/h3.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as h3 from 'h3';
2
- import { R as RouteFunction, W as WorkflowServeOptions } from './types-CfN1Epuj.js';
2
+ import { R as RouteFunction, W as WorkflowServeOptions } from './types-CoXaNrxX.js';
3
3
  import '@upstash/qstash';
4
4
 
5
5
  declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => h3.EventHandler<h3.EventHandlerRequest, Promise<Response | {
package/h3.js CHANGED
@@ -1419,6 +1419,16 @@ var sortSteps = (steps) => {
1419
1419
  return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1420
1420
  };
1421
1421
 
1422
+ // src/client/utils.ts
1423
+ var makeNotifyRequest = async (requester, eventId, eventData) => {
1424
+ const result = await requester.request({
1425
+ path: ["v2", "notify", eventId],
1426
+ method: "POST",
1427
+ body: typeof eventData === "string" ? eventData : JSON.stringify(eventData)
1428
+ });
1429
+ return result;
1430
+ };
1431
+
1422
1432
  // src/context/steps.ts
1423
1433
  var BaseLazyStep = class {
1424
1434
  stepName;
@@ -1577,6 +1587,19 @@ var LazyWaitForEventStep = class extends BaseLazyStep {
1577
1587
  });
1578
1588
  }
1579
1589
  };
1590
+ var LazyNotifyStep = class extends LazyFunctionStep {
1591
+ stepType = "Notify";
1592
+ constructor(stepName, eventId, eventData, requester) {
1593
+ super(stepName, async () => {
1594
+ const notifyResponse = await makeNotifyRequest(requester, eventId, eventData);
1595
+ return {
1596
+ eventId,
1597
+ eventData,
1598
+ notifyResponse
1599
+ };
1600
+ });
1601
+ }
1602
+ };
1580
1603
 
1581
1604
  // src/context/context.ts
1582
1605
  var WorkflowContext = class {
@@ -1823,6 +1846,38 @@ var WorkflowContext = class {
1823
1846
  return result;
1824
1847
  }
1825
1848
  }
1849
+ /**
1850
+ * Makes the workflow run wait until a notify request is sent or until the
1851
+ * timeout ends
1852
+ *
1853
+ * ```ts
1854
+ * const { eventData, timeout } = await context.waitForEvent(
1855
+ * "wait for event step",
1856
+ * "my-event-id",
1857
+ * 100 // timeout after 100 seconds
1858
+ * );
1859
+ * ```
1860
+ *
1861
+ * To notify a waiting workflow run, you can use the notify method:
1862
+ *
1863
+ * ```ts
1864
+ * import { Client } from "@upstash/workflow";
1865
+ *
1866
+ * const client = new Client({ token: });
1867
+ *
1868
+ * await client.notify({
1869
+ * eventId: "my-event-id",
1870
+ * eventData: "eventData"
1871
+ * })
1872
+ * ```
1873
+ *
1874
+ * @param stepName
1875
+ * @param eventId event id to wake up the waiting workflow run
1876
+ * @param timeout timeout duration in seconds
1877
+ * @returns wait response as `{ timeout: boolean, eventData: unknown }`.
1878
+ * timeout is true if the wait times out, if notified it is false. eventData
1879
+ * is the value passed to `client.notify`.
1880
+ */
1826
1881
  async waitForEvent(stepName, eventId, timeout) {
1827
1882
  const result = await this.addStep(
1828
1883
  new LazyWaitForEventStep(
@@ -1831,7 +1886,27 @@ var WorkflowContext = class {
1831
1886
  typeof timeout === "string" ? timeout : `${timeout}s`
1832
1887
  )
1833
1888
  );
1834
- return result;
1889
+ try {
1890
+ return {
1891
+ ...result,
1892
+ eventData: JSON.parse(result.eventData)
1893
+ };
1894
+ } catch {
1895
+ return result;
1896
+ }
1897
+ }
1898
+ async notify(stepName, eventId, eventData) {
1899
+ const result = await this.addStep(
1900
+ new LazyNotifyStep(stepName, eventId, eventData, this.qstashClient.http)
1901
+ );
1902
+ try {
1903
+ return {
1904
+ ...result,
1905
+ eventData: JSON.parse(result.eventData)
1906
+ };
1907
+ } catch {
1908
+ return result;
1909
+ }
1835
1910
  }
1836
1911
  /**
1837
1912
  * Adds steps to the executor. Needed so that it can be overwritten in
@@ -1932,7 +2007,7 @@ var parsePayload = (rawPayload) => {
1932
2007
  const step = JSON.parse(decodeBase64(rawStep.body));
1933
2008
  if (step.waitEventId) {
1934
2009
  const newOut = {
1935
- notifyBody: step.out,
2010
+ eventData: step.out,
1936
2011
  timeout: step.waitTimeout ?? false
1937
2012
  };
1938
2013
  step.out = newOut;
package/h3.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-JDMP6KKR.mjs";
3
+ } from "./chunk-BPN5JBNG.mjs";
4
4
 
5
5
  // node_modules/defu/dist/defu.mjs
6
6
  function isPlainObject(value) {
package/hono.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Context } from 'hono';
2
- import { R as RouteFunction, W as WorkflowServeOptions } from './types-CfN1Epuj.mjs';
2
+ import { R as RouteFunction, W as WorkflowServeOptions } from './types-CoXaNrxX.mjs';
3
3
  import '@upstash/qstash';
4
4
 
5
5
  type WorkflowBindings = {
package/hono.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Context } from 'hono';
2
- import { R as RouteFunction, W as WorkflowServeOptions } from './types-CfN1Epuj.js';
2
+ import { R as RouteFunction, W as WorkflowServeOptions } from './types-CoXaNrxX.js';
3
3
  import '@upstash/qstash';
4
4
 
5
5
  type WorkflowBindings = {
package/hono.js CHANGED
@@ -1110,6 +1110,16 @@ var sortSteps = (steps) => {
1110
1110
  return steps.toSorted((step, stepOther) => getStepId(step) - getStepId(stepOther));
1111
1111
  };
1112
1112
 
1113
+ // src/client/utils.ts
1114
+ var makeNotifyRequest = async (requester, eventId, eventData) => {
1115
+ const result = await requester.request({
1116
+ path: ["v2", "notify", eventId],
1117
+ method: "POST",
1118
+ body: typeof eventData === "string" ? eventData : JSON.stringify(eventData)
1119
+ });
1120
+ return result;
1121
+ };
1122
+
1113
1123
  // src/context/steps.ts
1114
1124
  var BaseLazyStep = class {
1115
1125
  stepName;
@@ -1268,6 +1278,19 @@ var LazyWaitForEventStep = class extends BaseLazyStep {
1268
1278
  });
1269
1279
  }
1270
1280
  };
1281
+ var LazyNotifyStep = class extends LazyFunctionStep {
1282
+ stepType = "Notify";
1283
+ constructor(stepName, eventId, eventData, requester) {
1284
+ super(stepName, async () => {
1285
+ const notifyResponse = await makeNotifyRequest(requester, eventId, eventData);
1286
+ return {
1287
+ eventId,
1288
+ eventData,
1289
+ notifyResponse
1290
+ };
1291
+ });
1292
+ }
1293
+ };
1271
1294
 
1272
1295
  // src/context/context.ts
1273
1296
  var WorkflowContext = class {
@@ -1514,6 +1537,38 @@ var WorkflowContext = class {
1514
1537
  return result;
1515
1538
  }
1516
1539
  }
1540
+ /**
1541
+ * Makes the workflow run wait until a notify request is sent or until the
1542
+ * timeout ends
1543
+ *
1544
+ * ```ts
1545
+ * const { eventData, timeout } = await context.waitForEvent(
1546
+ * "wait for event step",
1547
+ * "my-event-id",
1548
+ * 100 // timeout after 100 seconds
1549
+ * );
1550
+ * ```
1551
+ *
1552
+ * To notify a waiting workflow run, you can use the notify method:
1553
+ *
1554
+ * ```ts
1555
+ * import { Client } from "@upstash/workflow";
1556
+ *
1557
+ * const client = new Client({ token: });
1558
+ *
1559
+ * await client.notify({
1560
+ * eventId: "my-event-id",
1561
+ * eventData: "eventData"
1562
+ * })
1563
+ * ```
1564
+ *
1565
+ * @param stepName
1566
+ * @param eventId event id to wake up the waiting workflow run
1567
+ * @param timeout timeout duration in seconds
1568
+ * @returns wait response as `{ timeout: boolean, eventData: unknown }`.
1569
+ * timeout is true if the wait times out, if notified it is false. eventData
1570
+ * is the value passed to `client.notify`.
1571
+ */
1517
1572
  async waitForEvent(stepName, eventId, timeout) {
1518
1573
  const result = await this.addStep(
1519
1574
  new LazyWaitForEventStep(
@@ -1522,7 +1577,27 @@ var WorkflowContext = class {
1522
1577
  typeof timeout === "string" ? timeout : `${timeout}s`
1523
1578
  )
1524
1579
  );
1525
- return result;
1580
+ try {
1581
+ return {
1582
+ ...result,
1583
+ eventData: JSON.parse(result.eventData)
1584
+ };
1585
+ } catch {
1586
+ return result;
1587
+ }
1588
+ }
1589
+ async notify(stepName, eventId, eventData) {
1590
+ const result = await this.addStep(
1591
+ new LazyNotifyStep(stepName, eventId, eventData, this.qstashClient.http)
1592
+ );
1593
+ try {
1594
+ return {
1595
+ ...result,
1596
+ eventData: JSON.parse(result.eventData)
1597
+ };
1598
+ } catch {
1599
+ return result;
1600
+ }
1526
1601
  }
1527
1602
  /**
1528
1603
  * Adds steps to the executor. Needed so that it can be overwritten in
@@ -1623,7 +1698,7 @@ var parsePayload = (rawPayload) => {
1623
1698
  const step = JSON.parse(decodeBase64(rawStep.body));
1624
1699
  if (step.waitEventId) {
1625
1700
  const newOut = {
1626
- notifyBody: step.out,
1701
+ eventData: step.out,
1627
1702
  timeout: step.waitTimeout ?? false
1628
1703
  };
1629
1704
  step.out = newOut;
package/hono.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serve
3
- } from "./chunk-JDMP6KKR.mjs";
3
+ } from "./chunk-BPN5JBNG.mjs";
4
4
 
5
5
  // platforms/hono.ts
6
6
  var serve2 = (routeFunction, options) => {
package/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RouteFunction, W as WorkflowServeOptions, N as NotifyResponse, S as Step } from './types-CfN1Epuj.mjs';
2
- export { A as AsyncStepFunction, i as FailureFunctionPayload, F as FinishCondition, L as LogLevel, P as ParallelCallState, f as RawStep, j as RequiredExceptFields, h as StepFunction, e as StepType, d as StepTypes, g as SyncStepFunction, m as WaitRequest, k as WaitResult, n as WaitStepResponse, l as Waiter, b as WorkflowClient, a as WorkflowContext, p as WorkflowLogger, o as WorkflowLoggerOptions, c as WorkflowReceiver } from './types-CfN1Epuj.mjs';
1
+ import { R as RouteFunction, W as WorkflowServeOptions, N as NotifyResponse, a as Waiter, S as Step } from './types-CoXaNrxX.mjs';
2
+ export { A as AsyncStepFunction, j as FailureFunctionPayload, F as FinishCondition, L as LogLevel, n as NotifyStepResponse, P as ParallelCallState, g as RawStep, k as RequiredExceptFields, i as StepFunction, f as StepType, e as StepTypes, h as SyncStepFunction, l as WaitRequest, m as WaitStepResponse, c as WorkflowClient, b as WorkflowContext, p as WorkflowLogger, o as WorkflowLoggerOptions, d as WorkflowReceiver } from './types-CoXaNrxX.mjs';
3
3
  import { Client as Client$1, QstashError } from '@upstash/qstash';
4
4
 
5
5
  /**
@@ -31,12 +31,20 @@ declare class Client {
31
31
  * Notify a workflow run waiting for an event
32
32
  *
33
33
  * @param eventId event id to notify
34
- * @param notifyData data to provide to the workflow
34
+ * @param eventData data to provide to the workflow
35
35
  */
36
- notify({ eventId, notifyBody, }: {
36
+ notify({ eventId, eventData, }: {
37
37
  eventId: string;
38
- notifyBody?: string;
38
+ eventData?: unknown;
39
39
  }): Promise<NotifyResponse[]>;
40
+ /**
41
+ * Check waiters of an event
42
+ *
43
+ * @param eventId event id to check
44
+ */
45
+ getWaiters({ eventId }: {
46
+ eventId: string;
47
+ }): Promise<Waiter[]>;
40
48
  }
41
49
 
42
50
  /**
@@ -54,4 +62,4 @@ declare class QStashWorkflowAbort extends Error {
54
62
  constructor(stepName: string, stepInfo?: Step);
55
63
  }
56
64
 
57
- export { Client, NotifyResponse, QStashWorkflowAbort, QStashWorkflowError, RouteFunction, Step, WorkflowServeOptions, serve };
65
+ export { Client, NotifyResponse, QStashWorkflowAbort, QStashWorkflowError, RouteFunction, Step, Waiter, WorkflowServeOptions, serve };
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RouteFunction, W as WorkflowServeOptions, N as NotifyResponse, S as Step } from './types-CfN1Epuj.js';
2
- export { A as AsyncStepFunction, i as FailureFunctionPayload, F as FinishCondition, L as LogLevel, P as ParallelCallState, f as RawStep, j as RequiredExceptFields, h as StepFunction, e as StepType, d as StepTypes, g as SyncStepFunction, m as WaitRequest, k as WaitResult, n as WaitStepResponse, l as Waiter, b as WorkflowClient, a as WorkflowContext, p as WorkflowLogger, o as WorkflowLoggerOptions, c as WorkflowReceiver } from './types-CfN1Epuj.js';
1
+ import { R as RouteFunction, W as WorkflowServeOptions, N as NotifyResponse, a as Waiter, S as Step } from './types-CoXaNrxX.js';
2
+ export { A as AsyncStepFunction, j as FailureFunctionPayload, F as FinishCondition, L as LogLevel, n as NotifyStepResponse, P as ParallelCallState, g as RawStep, k as RequiredExceptFields, i as StepFunction, f as StepType, e as StepTypes, h as SyncStepFunction, l as WaitRequest, m as WaitStepResponse, c as WorkflowClient, b as WorkflowContext, p as WorkflowLogger, o as WorkflowLoggerOptions, d as WorkflowReceiver } from './types-CoXaNrxX.js';
3
3
  import { Client as Client$1, QstashError } from '@upstash/qstash';
4
4
 
5
5
  /**
@@ -31,12 +31,20 @@ declare class Client {
31
31
  * Notify a workflow run waiting for an event
32
32
  *
33
33
  * @param eventId event id to notify
34
- * @param notifyData data to provide to the workflow
34
+ * @param eventData data to provide to the workflow
35
35
  */
36
- notify({ eventId, notifyBody, }: {
36
+ notify({ eventId, eventData, }: {
37
37
  eventId: string;
38
- notifyBody?: string;
38
+ eventData?: unknown;
39
39
  }): Promise<NotifyResponse[]>;
40
+ /**
41
+ * Check waiters of an event
42
+ *
43
+ * @param eventId event id to check
44
+ */
45
+ getWaiters({ eventId }: {
46
+ eventId: string;
47
+ }): Promise<Waiter[]>;
40
48
  }
41
49
 
42
50
  /**
@@ -54,4 +62,4 @@ declare class QStashWorkflowAbort extends Error {
54
62
  constructor(stepName: string, stepInfo?: Step);
55
63
  }
56
64
 
57
- export { Client, NotifyResponse, QStashWorkflowAbort, QStashWorkflowError, RouteFunction, Step, WorkflowServeOptions, serve };
65
+ export { Client, NotifyResponse, QStashWorkflowAbort, QStashWorkflowError, RouteFunction, Step, Waiter, WorkflowServeOptions, serve };