@mastra/server 0.0.0-vnextWorkflows-20250422142014 → 0.0.0-workflow-deno-20250616130925

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.
Files changed (83) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +351 -60
  3. package/dist/_tsup-dts-rollup.d.ts +351 -60
  4. package/dist/{chunk-XISBMH56.js → chunk-2HXKRRNS.js} +11 -9
  5. package/dist/chunk-42IKSJNO.js +421 -0
  6. package/dist/chunk-42YJ2YVD.cjs +263 -0
  7. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  8. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  9. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  10. package/dist/{chunk-2FJURXCL.cjs → chunk-6TJSHFCJ.cjs} +44 -36
  11. package/dist/chunk-75ZPJI57.cjs +9 -0
  12. package/dist/chunk-ASKESBJW.cjs +2004 -0
  13. package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
  14. package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
  15. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  16. package/dist/{chunk-YANVFOYA.js → chunk-C7564HUT.js} +56 -34
  17. package/dist/chunk-CK32I2VN.cjs +435 -0
  18. package/dist/{chunk-4B7OUZXW.js → chunk-CLYX4KLH.js} +78 -63
  19. package/dist/chunk-CMMOIUFC.cjs +114 -0
  20. package/dist/{chunk-3RVHWGWO.js → chunk-CP55EVBK.js} +26 -13
  21. package/dist/chunk-GHC4YV6R.js +504 -0
  22. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  23. package/dist/{chunk-RBQASTUP.js → chunk-I7KJZNX5.js} +14 -6
  24. package/dist/chunk-IMBY5XUG.cjs +86 -0
  25. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  26. package/dist/chunk-MLKGABMK.js +7 -0
  27. package/dist/{chunk-HABV7TZK.cjs → chunk-NGURCFEJ.cjs} +28 -26
  28. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  29. package/dist/chunk-O2YAAFY3.js +255 -0
  30. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  31. package/dist/chunk-QLG2PFHE.js +81 -0
  32. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  33. package/dist/chunk-TGJMNUYJ.js +2001 -0
  34. package/dist/chunk-VPNDC2DI.cjs +148 -0
  35. package/dist/chunk-WE32JG64.cjs +332 -0
  36. package/dist/server/handlers/a2a.cjs +30 -0
  37. package/dist/server/handlers/a2a.d.cts +6 -0
  38. package/dist/server/handlers/a2a.d.ts +6 -0
  39. package/dist/server/handlers/a2a.js +1 -0
  40. package/dist/server/handlers/agents.cjs +7 -7
  41. package/dist/server/handlers/agents.js +1 -1
  42. package/dist/server/handlers/error.cjs +2 -2
  43. package/dist/server/handlers/error.js +1 -1
  44. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  45. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  46. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  47. package/dist/server/handlers/legacyWorkflows.js +1 -0
  48. package/dist/server/handlers/logs.cjs +4 -4
  49. package/dist/server/handlers/logs.js +1 -1
  50. package/dist/server/handlers/memory.cjs +9 -9
  51. package/dist/server/handlers/memory.js +1 -1
  52. package/dist/server/handlers/network.cjs +5 -5
  53. package/dist/server/handlers/network.js +1 -1
  54. package/dist/server/handlers/telemetry.cjs +3 -3
  55. package/dist/server/handlers/telemetry.js +1 -1
  56. package/dist/server/handlers/tools.cjs +5 -5
  57. package/dist/server/handlers/tools.js +1 -1
  58. package/dist/server/handlers/utils.cjs +2 -2
  59. package/dist/server/handlers/utils.js +1 -1
  60. package/dist/server/handlers/vector.cjs +7 -7
  61. package/dist/server/handlers/vector.js +1 -1
  62. package/dist/server/handlers/voice.cjs +8 -4
  63. package/dist/server/handlers/voice.d.cts +1 -0
  64. package/dist/server/handlers/voice.d.ts +1 -0
  65. package/dist/server/handlers/voice.js +1 -1
  66. package/dist/server/handlers/workflows.cjs +21 -13
  67. package/dist/server/handlers/workflows.d.cts +4 -2
  68. package/dist/server/handlers/workflows.d.ts +4 -2
  69. package/dist/server/handlers/workflows.js +1 -1
  70. package/dist/server/handlers.cjs +33 -23
  71. package/dist/server/handlers.d.cts +2 -0
  72. package/dist/server/handlers.d.ts +2 -0
  73. package/dist/server/handlers.js +11 -9
  74. package/package.json +13 -12
  75. package/dist/chunk-3EJZQ6TQ.js +0 -49
  76. package/dist/chunk-4WJ5GHRG.cjs +0 -164
  77. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  78. package/dist/chunk-A7DF4ETD.cjs +0 -100
  79. package/dist/chunk-JLDXUWK7.cjs +0 -126
  80. package/dist/chunk-OMN3UI6X.js +0 -5576
  81. package/dist/chunk-RNU4JMLM.cjs +0 -317
  82. package/dist/chunk-SKBVVI24.cjs +0 -54
  83. package/dist/chunk-TFFNX7FI.js +0 -156
@@ -0,0 +1,435 @@
1
+ 'use strict';
2
+
3
+ var chunkASKESBJW_cjs = require('./chunk-ASKESBJW.cjs');
4
+ var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
5
+ var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
6
+ var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
7
+ var web = require('stream/web');
8
+
9
+ // src/server/handlers/workflows.ts
10
+ var workflows_exports = {};
11
+ chunk75ZPJI57_cjs.__export(workflows_exports, {
12
+ createWorkflowRunHandler: () => createWorkflowRunHandler,
13
+ getWorkflowByIdHandler: () => getWorkflowByIdHandler,
14
+ getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
15
+ getWorkflowRunExecutionResultHandler: () => getWorkflowRunExecutionResultHandler,
16
+ getWorkflowRunsHandler: () => getWorkflowRunsHandler,
17
+ getWorkflowsHandler: () => getWorkflowsHandler,
18
+ resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
19
+ resumeWorkflowHandler: () => resumeWorkflowHandler,
20
+ startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
21
+ startWorkflowRunHandler: () => startWorkflowRunHandler,
22
+ streamWorkflowHandler: () => streamWorkflowHandler,
23
+ watchWorkflowHandler: () => watchWorkflowHandler
24
+ });
25
+ async function getWorkflowsHandler({ mastra }) {
26
+ try {
27
+ const workflows = mastra.getWorkflows({ serialized: false });
28
+ const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
29
+ acc[key] = {
30
+ name: workflow.name,
31
+ description: workflow.description,
32
+ steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
33
+ acc2[key2] = {
34
+ id: step.id,
35
+ description: step.description,
36
+ inputSchema: step.inputSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(step.inputSchema)) : void 0,
37
+ outputSchema: step.outputSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(step.outputSchema)) : void 0,
38
+ resumeSchema: step.resumeSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(step.resumeSchema)) : void 0,
39
+ suspendSchema: step.suspendSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(step.suspendSchema)) : void 0
40
+ };
41
+ return acc2;
42
+ }, {}),
43
+ stepGraph: workflow.serializedStepGraph,
44
+ inputSchema: workflow.inputSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(workflow.inputSchema)) : void 0,
45
+ outputSchema: workflow.outputSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(workflow.outputSchema)) : void 0
46
+ };
47
+ return acc;
48
+ }, {});
49
+ return _workflows;
50
+ } catch (error) {
51
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
52
+ }
53
+ }
54
+ async function getWorkflowsFromSystem({ mastra, workflowId }) {
55
+ const logger = mastra.getLogger();
56
+ if (!workflowId) {
57
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
58
+ }
59
+ let workflow;
60
+ try {
61
+ workflow = mastra.getWorkflow(workflowId);
62
+ } catch (error) {
63
+ logger.debug("Error getting workflow, searching agents for workflow", error);
64
+ }
65
+ if (!workflow) {
66
+ logger.debug("Workflow not found, searching agents for workflow", { workflowId });
67
+ const agents = mastra.getAgents();
68
+ if (Object.keys(agents || {}).length) {
69
+ for (const [_, agent] of Object.entries(agents)) {
70
+ try {
71
+ const workflows = await agent.getWorkflows();
72
+ if (workflows[workflowId]) {
73
+ workflow = workflows[workflowId];
74
+ break;
75
+ }
76
+ break;
77
+ } catch (error) {
78
+ logger.debug("Error getting workflow from agent", error);
79
+ }
80
+ }
81
+ }
82
+ }
83
+ if (!workflow) {
84
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
85
+ }
86
+ return { workflow };
87
+ }
88
+ async function getWorkflowByIdHandler({ mastra, workflowId }) {
89
+ try {
90
+ if (!workflowId) {
91
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
92
+ }
93
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
94
+ if (!workflow) {
95
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
96
+ }
97
+ return {
98
+ steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
99
+ acc[key] = {
100
+ id: step.id,
101
+ description: step.description,
102
+ inputSchema: step.inputSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(step.inputSchema)) : void 0,
103
+ outputSchema: step.outputSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(step.outputSchema)) : void 0,
104
+ resumeSchema: step.resumeSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(step.resumeSchema)) : void 0,
105
+ suspendSchema: step.suspendSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(step.suspendSchema)) : void 0
106
+ };
107
+ return acc;
108
+ }, {}),
109
+ name: workflow.name,
110
+ description: workflow.description,
111
+ stepGraph: workflow.serializedStepGraph,
112
+ inputSchema: workflow.inputSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(workflow.inputSchema)) : void 0,
113
+ outputSchema: workflow.outputSchema ? chunkASKESBJW_cjs.stringify(chunkASKESBJW_cjs.esm_default(workflow.outputSchema)) : void 0
114
+ };
115
+ } catch (error) {
116
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
117
+ }
118
+ }
119
+ async function getWorkflowRunByIdHandler({
120
+ mastra,
121
+ workflowId,
122
+ runId
123
+ }) {
124
+ try {
125
+ if (!workflowId) {
126
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
127
+ }
128
+ if (!runId) {
129
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
130
+ }
131
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
132
+ if (!workflow) {
133
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
134
+ }
135
+ const run = await workflow.getWorkflowRunById(runId);
136
+ if (!run) {
137
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
138
+ }
139
+ return run;
140
+ } catch (error) {
141
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
142
+ }
143
+ }
144
+ async function getWorkflowRunExecutionResultHandler({
145
+ mastra,
146
+ workflowId,
147
+ runId
148
+ }) {
149
+ try {
150
+ if (!workflowId) {
151
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
152
+ }
153
+ if (!runId) {
154
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
155
+ }
156
+ const workflow = mastra.getWorkflow(workflowId);
157
+ if (!workflow) {
158
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
159
+ }
160
+ const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
161
+ if (!executionResult) {
162
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
163
+ }
164
+ return executionResult;
165
+ } catch (error) {
166
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, {
167
+ message: error?.message || "Error getting workflow run execution result"
168
+ });
169
+ }
170
+ }
171
+ async function createWorkflowRunHandler({
172
+ mastra,
173
+ workflowId,
174
+ runId: prevRunId
175
+ }) {
176
+ try {
177
+ if (!workflowId) {
178
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
179
+ }
180
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
181
+ if (!workflow) {
182
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
183
+ }
184
+ const run = await workflow.createRun({ runId: prevRunId });
185
+ return { runId: run.runId };
186
+ } catch (error) {
187
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
188
+ }
189
+ }
190
+ async function startAsyncWorkflowHandler({
191
+ mastra,
192
+ runtimeContext,
193
+ workflowId,
194
+ runId,
195
+ inputData
196
+ }) {
197
+ try {
198
+ if (!workflowId) {
199
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
200
+ }
201
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
202
+ if (!workflow) {
203
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
204
+ }
205
+ const _run = await workflow.createRun({ runId });
206
+ const result = await _run.start({
207
+ inputData,
208
+ runtimeContext
209
+ });
210
+ return result;
211
+ } catch (error) {
212
+ throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
213
+ }
214
+ }
215
+ async function startWorkflowRunHandler({
216
+ mastra,
217
+ runtimeContext,
218
+ workflowId,
219
+ runId,
220
+ inputData
221
+ }) {
222
+ try {
223
+ if (!workflowId) {
224
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
225
+ }
226
+ if (!runId) {
227
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
228
+ }
229
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
230
+ if (!workflow) {
231
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
232
+ }
233
+ const run = await workflow.getWorkflowRunById(runId);
234
+ if (!run) {
235
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
236
+ }
237
+ const _run = await workflow.createRun({ runId });
238
+ void _run.start({
239
+ inputData,
240
+ runtimeContext
241
+ });
242
+ return { message: "Workflow run started" };
243
+ } catch (e) {
244
+ return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
245
+ }
246
+ }
247
+ async function watchWorkflowHandler({
248
+ mastra,
249
+ workflowId,
250
+ runId
251
+ }) {
252
+ try {
253
+ if (!workflowId) {
254
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
255
+ }
256
+ if (!runId) {
257
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
258
+ }
259
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
260
+ if (!workflow) {
261
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
262
+ }
263
+ const run = await workflow.getWorkflowRunById(runId);
264
+ if (!run) {
265
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
266
+ }
267
+ const _run = await workflow.createRun({ runId });
268
+ let unwatch;
269
+ let asyncRef = null;
270
+ const stream = new web.ReadableStream({
271
+ start(controller) {
272
+ unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
273
+ controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
274
+ if (asyncRef) {
275
+ clearImmediate(asyncRef);
276
+ asyncRef = null;
277
+ }
278
+ asyncRef = setImmediate(async () => {
279
+ const runDone = payload.workflowState.status !== "running";
280
+ if (runDone) {
281
+ controller.close();
282
+ unwatch?.();
283
+ }
284
+ });
285
+ });
286
+ },
287
+ cancel() {
288
+ unwatch?.();
289
+ }
290
+ });
291
+ return stream;
292
+ } catch (error) {
293
+ return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
294
+ }
295
+ }
296
+ async function streamWorkflowHandler({
297
+ mastra,
298
+ runtimeContext,
299
+ workflowId,
300
+ runId,
301
+ inputData
302
+ }) {
303
+ try {
304
+ if (!workflowId) {
305
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
306
+ }
307
+ if (!runId) {
308
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
309
+ }
310
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
311
+ if (!workflow) {
312
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
313
+ }
314
+ const run = await workflow.createRun({ runId });
315
+ const result = run.stream({
316
+ inputData,
317
+ runtimeContext
318
+ });
319
+ return result;
320
+ } catch (error) {
321
+ return chunk64U3UDTH_cjs.handleError(error, "Error executing workflow");
322
+ }
323
+ }
324
+ async function resumeAsyncWorkflowHandler({
325
+ mastra,
326
+ workflowId,
327
+ runId,
328
+ body,
329
+ runtimeContext
330
+ }) {
331
+ try {
332
+ if (!workflowId) {
333
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
334
+ }
335
+ if (!runId) {
336
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
337
+ }
338
+ if (!body.step) {
339
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
340
+ }
341
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
342
+ if (!workflow) {
343
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
344
+ }
345
+ const run = await workflow.getWorkflowRunById(runId);
346
+ if (!run) {
347
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
348
+ }
349
+ const _run = await workflow.createRun({ runId });
350
+ const result = await _run.resume({
351
+ step: body.step,
352
+ resumeData: body.resumeData,
353
+ runtimeContext
354
+ });
355
+ return result;
356
+ } catch (error) {
357
+ return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
358
+ }
359
+ }
360
+ async function resumeWorkflowHandler({
361
+ mastra,
362
+ workflowId,
363
+ runId,
364
+ body,
365
+ runtimeContext
366
+ }) {
367
+ try {
368
+ if (!workflowId) {
369
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
370
+ }
371
+ if (!runId) {
372
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
373
+ }
374
+ if (!body.step) {
375
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
376
+ }
377
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
378
+ if (!workflow) {
379
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
380
+ }
381
+ const run = await workflow.getWorkflowRunById(runId);
382
+ if (!run) {
383
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
384
+ }
385
+ const _run = await workflow.createRun({ runId });
386
+ void _run.resume({
387
+ step: body.step,
388
+ resumeData: body.resumeData,
389
+ runtimeContext
390
+ });
391
+ return { message: "Workflow run resumed" };
392
+ } catch (error) {
393
+ return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
394
+ }
395
+ }
396
+ async function getWorkflowRunsHandler({
397
+ mastra,
398
+ workflowId,
399
+ fromDate,
400
+ toDate,
401
+ limit,
402
+ offset,
403
+ resourceId
404
+ }) {
405
+ try {
406
+ if (!workflowId) {
407
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
408
+ }
409
+ const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
410
+ if (!workflow) {
411
+ throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
412
+ }
413
+ const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
414
+ runs: [],
415
+ total: 0
416
+ };
417
+ return workflowRuns;
418
+ } catch (error) {
419
+ return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
420
+ }
421
+ }
422
+
423
+ exports.createWorkflowRunHandler = createWorkflowRunHandler;
424
+ exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
425
+ exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
426
+ exports.getWorkflowRunExecutionResultHandler = getWorkflowRunExecutionResultHandler;
427
+ exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
428
+ exports.getWorkflowsHandler = getWorkflowsHandler;
429
+ exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
430
+ exports.resumeWorkflowHandler = resumeWorkflowHandler;
431
+ exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
432
+ exports.startWorkflowRunHandler = startWorkflowRunHandler;
433
+ exports.streamWorkflowHandler = streamWorkflowHandler;
434
+ exports.watchWorkflowHandler = watchWorkflowHandler;
435
+ exports.workflows_exports = workflows_exports;