@mastra/server 2.0.5-alpha.0 → 2.1.0-alpha.1
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/dist/_tsup-dts-rollup.d.cts +97 -96
- package/dist/_tsup-dts-rollup.d.ts +97 -96
- package/dist/{chunk-UCTEMO2Q.cjs → chunk-6B4OMWT6.cjs} +46 -44
- package/dist/{chunk-OGCNNUHF.cjs → chunk-7DLZLWJV.cjs} +3 -2
- package/dist/{chunk-MIQYDLLM.js → chunk-QY36IPTP.js} +36 -34
- package/dist/{chunk-EJO45KYT.js → chunk-W7VCKPAD.js} +34 -34
- package/dist/{chunk-HWZVAG3H.js → chunk-WFBJJNCK.js} +3 -2
- package/dist/{chunk-I2B73Y4I.cjs → chunk-YIOVBYZH.cjs} +44 -44
- package/dist/server/handlers/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/workflows.cjs +13 -13
- package/dist/server/handlers/workflows.d.cts +2 -2
- package/dist/server/handlers/workflows.d.ts +2 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +14 -14
- package/dist/server/handlers.d.cts +1 -1
- package/dist/server/handlers.d.ts +1 -1
- package/dist/server/handlers.js +4 -4
- package/package.json +4 -4
- package/dist/server/handlers/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
|
@@ -5,26 +5,27 @@ import { __export } from './chunk-MLKGABMK.js';
|
|
|
5
5
|
import { ReadableStream } from 'node:stream/web';
|
|
6
6
|
import { RuntimeContext } from '@mastra/core/di';
|
|
7
7
|
|
|
8
|
-
// src/server/handlers/
|
|
9
|
-
var
|
|
10
|
-
__export(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
// src/server/handlers/workflows.ts
|
|
9
|
+
var workflows_exports = {};
|
|
10
|
+
__export(workflows_exports, {
|
|
11
|
+
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
12
|
+
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
13
|
+
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
14
|
+
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
15
|
+
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
16
|
+
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
17
|
+
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
18
|
+
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
19
|
+
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
20
|
+
watchWorkflowHandler: () => watchWorkflowHandler
|
|
21
21
|
});
|
|
22
|
-
async function
|
|
22
|
+
async function getWorkflowsHandler({ mastra }) {
|
|
23
23
|
try {
|
|
24
|
-
const workflows = mastra.
|
|
24
|
+
const workflows = mastra.getWorkflows({ serialized: false });
|
|
25
25
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
26
26
|
acc[key] = {
|
|
27
27
|
name: workflow.name,
|
|
28
|
+
description: workflow.description,
|
|
28
29
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
29
30
|
acc2[key2] = {
|
|
30
31
|
id: step.id,
|
|
@@ -47,12 +48,12 @@ async function getVNextWorkflowsHandler({ mastra }) {
|
|
|
47
48
|
throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
|
-
async function
|
|
51
|
+
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
51
52
|
try {
|
|
52
53
|
if (!workflowId) {
|
|
53
54
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
54
55
|
}
|
|
55
|
-
const workflow = mastra.
|
|
56
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
56
57
|
if (!workflow) {
|
|
57
58
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
58
59
|
}
|
|
@@ -69,6 +70,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
69
70
|
return acc;
|
|
70
71
|
}, {}),
|
|
71
72
|
name: workflow.name,
|
|
73
|
+
description: workflow.description,
|
|
72
74
|
stepGraph: workflow.serializedStepGraph,
|
|
73
75
|
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
74
76
|
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
@@ -77,7 +79,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
77
79
|
throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
async function
|
|
82
|
+
async function getWorkflowRunByIdHandler({
|
|
81
83
|
mastra,
|
|
82
84
|
workflowId,
|
|
83
85
|
runId
|
|
@@ -89,7 +91,7 @@ async function getVNextWorkflowRunByIdHandler({
|
|
|
89
91
|
if (!runId) {
|
|
90
92
|
throw new HTTPException(400, { message: "Run ID is required" });
|
|
91
93
|
}
|
|
92
|
-
const workflow = mastra.
|
|
94
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
93
95
|
if (!workflow) {
|
|
94
96
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
95
97
|
}
|
|
@@ -102,7 +104,7 @@ async function getVNextWorkflowRunByIdHandler({
|
|
|
102
104
|
throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
|
-
async function
|
|
107
|
+
async function createWorkflowRunHandler({
|
|
106
108
|
mastra,
|
|
107
109
|
workflowId,
|
|
108
110
|
runId: prevRunId
|
|
@@ -111,7 +113,7 @@ async function createVNextWorkflowRunHandler({
|
|
|
111
113
|
if (!workflowId) {
|
|
112
114
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
113
115
|
}
|
|
114
|
-
const workflow = mastra.
|
|
116
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
115
117
|
if (!workflow) {
|
|
116
118
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
117
119
|
}
|
|
@@ -121,7 +123,7 @@ async function createVNextWorkflowRunHandler({
|
|
|
121
123
|
throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
|
-
async function
|
|
126
|
+
async function startAsyncWorkflowHandler({
|
|
125
127
|
mastra,
|
|
126
128
|
runtimeContext,
|
|
127
129
|
workflowId,
|
|
@@ -133,7 +135,7 @@ async function startAsyncVNextWorkflowHandler({
|
|
|
133
135
|
if (!workflowId) {
|
|
134
136
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
135
137
|
}
|
|
136
|
-
const workflow = mastra.
|
|
138
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
137
139
|
if (!workflow) {
|
|
138
140
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
139
141
|
}
|
|
@@ -151,7 +153,7 @@ async function startAsyncVNextWorkflowHandler({
|
|
|
151
153
|
throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
|
-
async function
|
|
156
|
+
async function startWorkflowRunHandler({
|
|
155
157
|
mastra,
|
|
156
158
|
runtimeContext,
|
|
157
159
|
workflowId,
|
|
@@ -166,7 +168,7 @@ async function startVNextWorkflowRunHandler({
|
|
|
166
168
|
if (!runId) {
|
|
167
169
|
throw new HTTPException(400, { message: "runId required to start run" });
|
|
168
170
|
}
|
|
169
|
-
const workflow = mastra.
|
|
171
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
170
172
|
const run = await workflow.getWorkflowRunById(runId);
|
|
171
173
|
if (!run) {
|
|
172
174
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -185,7 +187,7 @@ async function startVNextWorkflowRunHandler({
|
|
|
185
187
|
return handleError(e, "Error starting workflow run");
|
|
186
188
|
}
|
|
187
189
|
}
|
|
188
|
-
async function
|
|
190
|
+
async function watchWorkflowHandler({
|
|
189
191
|
mastra,
|
|
190
192
|
workflowId,
|
|
191
193
|
runId
|
|
@@ -197,7 +199,7 @@ async function watchVNextWorkflowHandler({
|
|
|
197
199
|
if (!runId) {
|
|
198
200
|
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
199
201
|
}
|
|
200
|
-
const workflow = mastra.
|
|
202
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
201
203
|
const run = await workflow.getWorkflowRunById(runId);
|
|
202
204
|
if (!run) {
|
|
203
205
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -231,7 +233,7 @@ async function watchVNextWorkflowHandler({
|
|
|
231
233
|
return handleError(error, "Error watching workflow");
|
|
232
234
|
}
|
|
233
235
|
}
|
|
234
|
-
async function
|
|
236
|
+
async function resumeAsyncWorkflowHandler({
|
|
235
237
|
mastra,
|
|
236
238
|
workflowId,
|
|
237
239
|
runId,
|
|
@@ -249,7 +251,7 @@ async function resumeAsyncVNextWorkflowHandler({
|
|
|
249
251
|
if (!body.step) {
|
|
250
252
|
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
251
253
|
}
|
|
252
|
-
const workflow = mastra.
|
|
254
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
253
255
|
const run = await workflow.getWorkflowRunById(runId);
|
|
254
256
|
if (!run) {
|
|
255
257
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -269,7 +271,7 @@ async function resumeAsyncVNextWorkflowHandler({
|
|
|
269
271
|
return handleError(error, "Error resuming workflow step");
|
|
270
272
|
}
|
|
271
273
|
}
|
|
272
|
-
async function
|
|
274
|
+
async function resumeWorkflowHandler({
|
|
273
275
|
mastra,
|
|
274
276
|
workflowId,
|
|
275
277
|
runId,
|
|
@@ -286,7 +288,7 @@ async function resumeVNextWorkflowHandler({
|
|
|
286
288
|
if (!body.step) {
|
|
287
289
|
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
288
290
|
}
|
|
289
|
-
const workflow = mastra.
|
|
291
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
290
292
|
const run = await workflow.getWorkflowRunById(runId);
|
|
291
293
|
if (!run) {
|
|
292
294
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -302,7 +304,7 @@ async function resumeVNextWorkflowHandler({
|
|
|
302
304
|
return handleError(error, "Error resuming workflow");
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
|
-
async function
|
|
307
|
+
async function getWorkflowRunsHandler({
|
|
306
308
|
mastra,
|
|
307
309
|
workflowId,
|
|
308
310
|
fromDate,
|
|
@@ -315,7 +317,7 @@ async function getVNextWorkflowRunsHandler({
|
|
|
315
317
|
if (!workflowId) {
|
|
316
318
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
317
319
|
}
|
|
318
|
-
const workflow = mastra.
|
|
320
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
319
321
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
320
322
|
runs: [],
|
|
321
323
|
total: 0
|
|
@@ -326,4 +328,4 @@ async function getVNextWorkflowRunsHandler({
|
|
|
326
328
|
}
|
|
327
329
|
}
|
|
328
330
|
|
|
329
|
-
export {
|
|
331
|
+
export { createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler, workflows_exports };
|
|
@@ -4,23 +4,23 @@ import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
|
4
4
|
import { __export } from './chunk-MLKGABMK.js';
|
|
5
5
|
import { ReadableStream } from 'node:stream/web';
|
|
6
6
|
|
|
7
|
-
// src/server/handlers/
|
|
8
|
-
var
|
|
9
|
-
__export(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
// src/server/handlers/legacyWorkflows.ts
|
|
8
|
+
var legacyWorkflows_exports = {};
|
|
9
|
+
__export(legacyWorkflows_exports, {
|
|
10
|
+
createLegacyWorkflowRunHandler: () => createLegacyWorkflowRunHandler,
|
|
11
|
+
getLegacyWorkflowByIdHandler: () => getLegacyWorkflowByIdHandler,
|
|
12
|
+
getLegacyWorkflowRunHandler: () => getLegacyWorkflowRunHandler,
|
|
13
|
+
getLegacyWorkflowRunsHandler: () => getLegacyWorkflowRunsHandler,
|
|
14
|
+
getLegacyWorkflowsHandler: () => getLegacyWorkflowsHandler,
|
|
15
|
+
resumeAsyncLegacyWorkflowHandler: () => resumeAsyncLegacyWorkflowHandler,
|
|
16
|
+
resumeLegacyWorkflowHandler: () => resumeLegacyWorkflowHandler,
|
|
17
|
+
startAsyncLegacyWorkflowHandler: () => startAsyncLegacyWorkflowHandler,
|
|
18
|
+
startLegacyWorkflowRunHandler: () => startLegacyWorkflowRunHandler,
|
|
19
|
+
watchLegacyWorkflowHandler: () => watchLegacyWorkflowHandler
|
|
20
20
|
});
|
|
21
|
-
async function
|
|
21
|
+
async function getLegacyWorkflowsHandler({ mastra }) {
|
|
22
22
|
try {
|
|
23
|
-
const workflows = mastra.
|
|
23
|
+
const workflows = mastra.legacy_getWorkflows({ serialized: false });
|
|
24
24
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
25
25
|
if (workflow.isNested) return acc;
|
|
26
26
|
acc[key] = {
|
|
@@ -49,12 +49,12 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
49
49
|
throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
|
|
53
53
|
try {
|
|
54
54
|
if (!workflowId) {
|
|
55
55
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
56
56
|
}
|
|
57
|
-
const workflow = mastra.
|
|
57
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
58
58
|
if (!workflow) {
|
|
59
59
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
60
60
|
}
|
|
@@ -81,7 +81,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
81
81
|
throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
async function
|
|
84
|
+
async function startAsyncLegacyWorkflowHandler({
|
|
85
85
|
mastra,
|
|
86
86
|
runtimeContext,
|
|
87
87
|
workflowId,
|
|
@@ -92,7 +92,7 @@ async function startAsyncWorkflowHandler({
|
|
|
92
92
|
if (!workflowId) {
|
|
93
93
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
94
94
|
}
|
|
95
|
-
const workflow = mastra.
|
|
95
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
96
96
|
if (!workflow) {
|
|
97
97
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
98
98
|
}
|
|
@@ -117,7 +117,7 @@ async function startAsyncWorkflowHandler({
|
|
|
117
117
|
throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
async function
|
|
120
|
+
async function getLegacyWorkflowRunHandler({
|
|
121
121
|
mastra,
|
|
122
122
|
workflowId,
|
|
123
123
|
runId
|
|
@@ -129,7 +129,7 @@ async function getWorkflowRunHandler({
|
|
|
129
129
|
if (!runId) {
|
|
130
130
|
throw new HTTPException(400, { message: "Run ID is required" });
|
|
131
131
|
}
|
|
132
|
-
const workflow = mastra.
|
|
132
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
133
133
|
if (!workflow) {
|
|
134
134
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
135
135
|
}
|
|
@@ -142,7 +142,7 @@ async function getWorkflowRunHandler({
|
|
|
142
142
|
throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
async function
|
|
145
|
+
async function createLegacyWorkflowRunHandler({
|
|
146
146
|
mastra,
|
|
147
147
|
workflowId,
|
|
148
148
|
runId: prevRunId
|
|
@@ -151,7 +151,7 @@ async function createRunHandler({
|
|
|
151
151
|
if (!workflowId) {
|
|
152
152
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
153
153
|
}
|
|
154
|
-
const workflow = mastra.
|
|
154
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
155
155
|
if (!workflow) {
|
|
156
156
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
157
157
|
}
|
|
@@ -161,7 +161,7 @@ async function createRunHandler({
|
|
|
161
161
|
throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
async function
|
|
164
|
+
async function startLegacyWorkflowRunHandler({
|
|
165
165
|
mastra,
|
|
166
166
|
runtimeContext,
|
|
167
167
|
workflowId,
|
|
@@ -175,7 +175,7 @@ async function startWorkflowRunHandler({
|
|
|
175
175
|
if (!runId) {
|
|
176
176
|
throw new HTTPException(400, { message: "runId required to start run" });
|
|
177
177
|
}
|
|
178
|
-
const workflow = mastra.
|
|
178
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
179
179
|
const run = workflow.getMemoryRun(runId);
|
|
180
180
|
if (!run) {
|
|
181
181
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -189,7 +189,7 @@ async function startWorkflowRunHandler({
|
|
|
189
189
|
return handleError(e, "Error starting workflow run");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function watchLegacyWorkflowHandler({
|
|
193
193
|
mastra,
|
|
194
194
|
workflowId,
|
|
195
195
|
runId
|
|
@@ -201,7 +201,7 @@ async function watchWorkflowHandler({
|
|
|
201
201
|
if (!runId) {
|
|
202
202
|
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
203
203
|
}
|
|
204
|
-
const workflow = mastra.
|
|
204
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
205
205
|
const run = workflow.getMemoryRun(runId);
|
|
206
206
|
if (!run) {
|
|
207
207
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -235,7 +235,7 @@ async function watchWorkflowHandler({
|
|
|
235
235
|
return handleError(error, "Error watching workflow");
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
async function
|
|
238
|
+
async function resumeAsyncLegacyWorkflowHandler({
|
|
239
239
|
mastra,
|
|
240
240
|
workflowId,
|
|
241
241
|
runId,
|
|
@@ -249,7 +249,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
249
249
|
if (!runId) {
|
|
250
250
|
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
251
251
|
}
|
|
252
|
-
const workflow = mastra.
|
|
252
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
253
253
|
const run = workflow.getMemoryRun(runId);
|
|
254
254
|
if (!run) {
|
|
255
255
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -264,7 +264,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
264
264
|
return handleError(error, "Error resuming workflow step");
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
async function
|
|
267
|
+
async function resumeLegacyWorkflowHandler({
|
|
268
268
|
mastra,
|
|
269
269
|
workflowId,
|
|
270
270
|
runId,
|
|
@@ -278,7 +278,7 @@ async function resumeWorkflowHandler({
|
|
|
278
278
|
if (!runId) {
|
|
279
279
|
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
280
280
|
}
|
|
281
|
-
const workflow = mastra.
|
|
281
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
282
282
|
const run = workflow.getMemoryRun(runId);
|
|
283
283
|
if (!run) {
|
|
284
284
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -293,7 +293,7 @@ async function resumeWorkflowHandler({
|
|
|
293
293
|
return handleError(error, "Error resuming workflow");
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
async function
|
|
296
|
+
async function getLegacyWorkflowRunsHandler({
|
|
297
297
|
mastra,
|
|
298
298
|
workflowId,
|
|
299
299
|
fromDate,
|
|
@@ -306,7 +306,7 @@ async function getWorkflowRunsHandler({
|
|
|
306
306
|
if (!workflowId) {
|
|
307
307
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
308
308
|
}
|
|
309
|
-
const workflow = mastra.
|
|
309
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
310
310
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
311
311
|
runs: [],
|
|
312
312
|
total: 0
|
|
@@ -317,4 +317,4 @@ async function getWorkflowRunsHandler({
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
export {
|
|
320
|
+
export { createLegacyWorkflowRunHandler, getLegacyWorkflowByIdHandler, getLegacyWorkflowRunHandler, getLegacyWorkflowRunsHandler, getLegacyWorkflowsHandler, legacyWorkflows_exports, resumeAsyncLegacyWorkflowHandler, resumeLegacyWorkflowHandler, startAsyncLegacyWorkflowHandler, startLegacyWorkflowRunHandler, watchLegacyWorkflowHandler };
|
|
@@ -37,9 +37,10 @@ async function getLogsByRunIdHandler({
|
|
|
37
37
|
async function getLogTransports({ mastra }) {
|
|
38
38
|
try {
|
|
39
39
|
const logger = mastra.getLogger();
|
|
40
|
-
|
|
40
|
+
console.log(logger);
|
|
41
|
+
const transports = logger.getTransports();
|
|
41
42
|
return {
|
|
42
|
-
transports: transports ?
|
|
43
|
+
transports: transports ? [...transports.keys()] : []
|
|
43
44
|
};
|
|
44
45
|
} catch (error) {
|
|
45
46
|
return handleError(error, "Error getting log Transports");
|
|
@@ -6,23 +6,23 @@ var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
|
6
6
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
7
|
var web = require('stream/web');
|
|
8
8
|
|
|
9
|
-
// src/server/handlers/
|
|
10
|
-
var
|
|
11
|
-
chunk75ZPJI57_cjs.__export(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
// src/server/handlers/legacyWorkflows.ts
|
|
10
|
+
var legacyWorkflows_exports = {};
|
|
11
|
+
chunk75ZPJI57_cjs.__export(legacyWorkflows_exports, {
|
|
12
|
+
createLegacyWorkflowRunHandler: () => createLegacyWorkflowRunHandler,
|
|
13
|
+
getLegacyWorkflowByIdHandler: () => getLegacyWorkflowByIdHandler,
|
|
14
|
+
getLegacyWorkflowRunHandler: () => getLegacyWorkflowRunHandler,
|
|
15
|
+
getLegacyWorkflowRunsHandler: () => getLegacyWorkflowRunsHandler,
|
|
16
|
+
getLegacyWorkflowsHandler: () => getLegacyWorkflowsHandler,
|
|
17
|
+
resumeAsyncLegacyWorkflowHandler: () => resumeAsyncLegacyWorkflowHandler,
|
|
18
|
+
resumeLegacyWorkflowHandler: () => resumeLegacyWorkflowHandler,
|
|
19
|
+
startAsyncLegacyWorkflowHandler: () => startAsyncLegacyWorkflowHandler,
|
|
20
|
+
startLegacyWorkflowRunHandler: () => startLegacyWorkflowRunHandler,
|
|
21
|
+
watchLegacyWorkflowHandler: () => watchLegacyWorkflowHandler
|
|
22
22
|
});
|
|
23
|
-
async function
|
|
23
|
+
async function getLegacyWorkflowsHandler({ mastra }) {
|
|
24
24
|
try {
|
|
25
|
-
const workflows = mastra.
|
|
25
|
+
const workflows = mastra.legacy_getWorkflows({ serialized: false });
|
|
26
26
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
27
27
|
if (workflow.isNested) return acc;
|
|
28
28
|
acc[key] = {
|
|
@@ -51,12 +51,12 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
51
51
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
async function
|
|
54
|
+
async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
|
|
55
55
|
try {
|
|
56
56
|
if (!workflowId) {
|
|
57
57
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
58
58
|
}
|
|
59
|
-
const workflow = mastra.
|
|
59
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
60
60
|
if (!workflow) {
|
|
61
61
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
62
62
|
}
|
|
@@ -83,7 +83,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
83
83
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
async function
|
|
86
|
+
async function startAsyncLegacyWorkflowHandler({
|
|
87
87
|
mastra,
|
|
88
88
|
runtimeContext,
|
|
89
89
|
workflowId,
|
|
@@ -94,7 +94,7 @@ async function startAsyncWorkflowHandler({
|
|
|
94
94
|
if (!workflowId) {
|
|
95
95
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
96
96
|
}
|
|
97
|
-
const workflow = mastra.
|
|
97
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
98
98
|
if (!workflow) {
|
|
99
99
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
100
100
|
}
|
|
@@ -119,7 +119,7 @@ async function startAsyncWorkflowHandler({
|
|
|
119
119
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
async function
|
|
122
|
+
async function getLegacyWorkflowRunHandler({
|
|
123
123
|
mastra,
|
|
124
124
|
workflowId,
|
|
125
125
|
runId
|
|
@@ -131,7 +131,7 @@ async function getWorkflowRunHandler({
|
|
|
131
131
|
if (!runId) {
|
|
132
132
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
133
133
|
}
|
|
134
|
-
const workflow = mastra.
|
|
134
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
135
135
|
if (!workflow) {
|
|
136
136
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
137
137
|
}
|
|
@@ -144,7 +144,7 @@ async function getWorkflowRunHandler({
|
|
|
144
144
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
async function
|
|
147
|
+
async function createLegacyWorkflowRunHandler({
|
|
148
148
|
mastra,
|
|
149
149
|
workflowId,
|
|
150
150
|
runId: prevRunId
|
|
@@ -153,7 +153,7 @@ async function createRunHandler({
|
|
|
153
153
|
if (!workflowId) {
|
|
154
154
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
155
155
|
}
|
|
156
|
-
const workflow = mastra.
|
|
156
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
157
157
|
if (!workflow) {
|
|
158
158
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
159
159
|
}
|
|
@@ -163,7 +163,7 @@ async function createRunHandler({
|
|
|
163
163
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
async function
|
|
166
|
+
async function startLegacyWorkflowRunHandler({
|
|
167
167
|
mastra,
|
|
168
168
|
runtimeContext,
|
|
169
169
|
workflowId,
|
|
@@ -177,7 +177,7 @@ async function startWorkflowRunHandler({
|
|
|
177
177
|
if (!runId) {
|
|
178
178
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
179
179
|
}
|
|
180
|
-
const workflow = mastra.
|
|
180
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
181
181
|
const run = workflow.getMemoryRun(runId);
|
|
182
182
|
if (!run) {
|
|
183
183
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -191,7 +191,7 @@ async function startWorkflowRunHandler({
|
|
|
191
191
|
return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
async function
|
|
194
|
+
async function watchLegacyWorkflowHandler({
|
|
195
195
|
mastra,
|
|
196
196
|
workflowId,
|
|
197
197
|
runId
|
|
@@ -203,7 +203,7 @@ async function watchWorkflowHandler({
|
|
|
203
203
|
if (!runId) {
|
|
204
204
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
205
205
|
}
|
|
206
|
-
const workflow = mastra.
|
|
206
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
207
207
|
const run = workflow.getMemoryRun(runId);
|
|
208
208
|
if (!run) {
|
|
209
209
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -237,7 +237,7 @@ async function watchWorkflowHandler({
|
|
|
237
237
|
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
async function
|
|
240
|
+
async function resumeAsyncLegacyWorkflowHandler({
|
|
241
241
|
mastra,
|
|
242
242
|
workflowId,
|
|
243
243
|
runId,
|
|
@@ -251,7 +251,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
251
251
|
if (!runId) {
|
|
252
252
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
253
253
|
}
|
|
254
|
-
const workflow = mastra.
|
|
254
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
255
255
|
const run = workflow.getMemoryRun(runId);
|
|
256
256
|
if (!run) {
|
|
257
257
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -266,7 +266,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
266
266
|
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
269
|
+
async function resumeLegacyWorkflowHandler({
|
|
270
270
|
mastra,
|
|
271
271
|
workflowId,
|
|
272
272
|
runId,
|
|
@@ -280,7 +280,7 @@ async function resumeWorkflowHandler({
|
|
|
280
280
|
if (!runId) {
|
|
281
281
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
282
282
|
}
|
|
283
|
-
const workflow = mastra.
|
|
283
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
284
284
|
const run = workflow.getMemoryRun(runId);
|
|
285
285
|
if (!run) {
|
|
286
286
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -295,7 +295,7 @@ async function resumeWorkflowHandler({
|
|
|
295
295
|
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
async function
|
|
298
|
+
async function getLegacyWorkflowRunsHandler({
|
|
299
299
|
mastra,
|
|
300
300
|
workflowId,
|
|
301
301
|
fromDate,
|
|
@@ -308,7 +308,7 @@ async function getWorkflowRunsHandler({
|
|
|
308
308
|
if (!workflowId) {
|
|
309
309
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
310
310
|
}
|
|
311
|
-
const workflow = mastra.
|
|
311
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
312
312
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
313
313
|
runs: [],
|
|
314
314
|
total: 0
|
|
@@ -319,14 +319,14 @@ async function getWorkflowRunsHandler({
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
exports.
|
|
323
|
-
exports.
|
|
324
|
-
exports.
|
|
325
|
-
exports.
|
|
326
|
-
exports.
|
|
327
|
-
exports.
|
|
328
|
-
exports.
|
|
329
|
-
exports.
|
|
330
|
-
exports.
|
|
331
|
-
exports.
|
|
332
|
-
exports.
|
|
322
|
+
exports.createLegacyWorkflowRunHandler = createLegacyWorkflowRunHandler;
|
|
323
|
+
exports.getLegacyWorkflowByIdHandler = getLegacyWorkflowByIdHandler;
|
|
324
|
+
exports.getLegacyWorkflowRunHandler = getLegacyWorkflowRunHandler;
|
|
325
|
+
exports.getLegacyWorkflowRunsHandler = getLegacyWorkflowRunsHandler;
|
|
326
|
+
exports.getLegacyWorkflowsHandler = getLegacyWorkflowsHandler;
|
|
327
|
+
exports.legacyWorkflows_exports = legacyWorkflows_exports;
|
|
328
|
+
exports.resumeAsyncLegacyWorkflowHandler = resumeAsyncLegacyWorkflowHandler;
|
|
329
|
+
exports.resumeLegacyWorkflowHandler = resumeLegacyWorkflowHandler;
|
|
330
|
+
exports.startAsyncLegacyWorkflowHandler = startAsyncLegacyWorkflowHandler;
|
|
331
|
+
exports.startLegacyWorkflowRunHandler = startLegacyWorkflowRunHandler;
|
|
332
|
+
exports.watchLegacyWorkflowHandler = watchLegacyWorkflowHandler;
|