@mastra/server 0.0.0-vector-sources-20250516175436 → 0.0.0-vector-extension-schema-20250922130418
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/CHANGELOG.md +3745 -0
- package/LICENSE.md +11 -42
- package/README.md +0 -5
- package/dist/{chunk-H5PTF3Y4.js → chunk-4QCXUEAT.js} +11 -2
- package/dist/chunk-4QCXUEAT.js.map +1 -0
- package/dist/chunk-4RRMWXQ2.js +3522 -0
- package/dist/chunk-4RRMWXQ2.js.map +1 -0
- package/dist/chunk-57HWW2TY.cjs +587 -0
- package/dist/chunk-57HWW2TY.cjs.map +1 -0
- package/dist/chunk-5DP5XZH6.cjs +928 -0
- package/dist/chunk-5DP5XZH6.cjs.map +1 -0
- package/dist/chunk-66YYHFGF.js +761 -0
- package/dist/chunk-66YYHFGF.js.map +1 -0
- package/dist/chunk-6GMFZ5LK.js +2774 -0
- package/dist/chunk-6GMFZ5LK.js.map +1 -0
- package/dist/chunk-743UIDHI.cjs +2013 -0
- package/dist/chunk-743UIDHI.cjs.map +1 -0
- package/dist/chunk-7JYXPDM4.js +15712 -0
- package/dist/chunk-7JYXPDM4.js.map +1 -0
- package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
- package/dist/chunk-7NADHFD2.cjs.map +1 -0
- package/dist/chunk-7QEJ5QG5.js +151 -0
- package/dist/chunk-7QEJ5QG5.js.map +1 -0
- package/dist/chunk-A3AL7EWJ.js +83 -0
- package/dist/chunk-A3AL7EWJ.js.map +1 -0
- package/dist/chunk-AK2FXLLB.cjs +849 -0
- package/dist/chunk-AK2FXLLB.cjs.map +1 -0
- package/dist/{chunk-5SN4U5AC.cjs → chunk-AVEPEUN4.cjs} +115 -138
- package/dist/chunk-AVEPEUN4.cjs.map +1 -0
- package/dist/chunk-CNU4A2XU.js +129 -0
- package/dist/chunk-CNU4A2XU.js.map +1 -0
- package/dist/chunk-CY4TP3FK.js +16 -0
- package/dist/chunk-CY4TP3FK.js.map +1 -0
- package/dist/chunk-EMMSS5I5.cjs +37 -0
- package/dist/chunk-EMMSS5I5.cjs.map +1 -0
- package/dist/chunk-EMNGA4R4.js +845 -0
- package/dist/chunk-EMNGA4R4.js.map +1 -0
- package/dist/chunk-FALVL2VV.cjs +3525 -0
- package/dist/chunk-FALVL2VV.cjs.map +1 -0
- package/dist/chunk-FQNT7PI4.js +937 -0
- package/dist/chunk-FQNT7PI4.js.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-G4PUALCE.cjs +28 -0
- package/dist/chunk-G4PUALCE.cjs.map +1 -0
- package/dist/chunk-G662L2YZ.js +568 -0
- package/dist/chunk-G662L2YZ.js.map +1 -0
- package/dist/chunk-GDWMF6SB.cjs +133 -0
- package/dist/chunk-GDWMF6SB.cjs.map +1 -0
- package/dist/chunk-GU4EWMZB.cjs +769 -0
- package/dist/chunk-GU4EWMZB.cjs.map +1 -0
- package/dist/chunk-GUI3CROV.cjs +159 -0
- package/dist/chunk-GUI3CROV.cjs.map +1 -0
- package/dist/chunk-HJQKWRKQ.cjs +764 -0
- package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
- package/dist/{chunk-YWLUOY3D.cjs → chunk-HVBBFCDH.cjs} +1110 -793
- package/dist/chunk-HVBBFCDH.cjs.map +1 -0
- package/dist/chunk-HZJRQ5L3.cjs +1411 -0
- package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
- package/dist/chunk-IGFMAZZ5.cjs +1150 -0
- package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
- package/dist/chunk-ILESGJ6N.js +524 -0
- package/dist/chunk-ILESGJ6N.js.map +1 -0
- package/dist/chunk-IOQGI4ML.js +931 -0
- package/dist/chunk-IOQGI4ML.js.map +1 -0
- package/dist/chunk-J7BPKKOG.cjs +163 -0
- package/dist/chunk-J7BPKKOG.cjs.map +1 -0
- package/dist/{chunk-HFWCEP5S.js → chunk-JRDEOHAJ.js} +47 -14
- package/dist/chunk-JRDEOHAJ.js.map +1 -0
- package/dist/chunk-KNGXRN26.cjs +335 -0
- package/dist/chunk-KNGXRN26.cjs.map +1 -0
- package/dist/{chunk-OR3CIE2H.js → chunk-KV6VHX4V.js} +29 -7
- package/dist/chunk-KV6VHX4V.js.map +1 -0
- package/dist/chunk-L265APUD.cjs +69 -0
- package/dist/chunk-L265APUD.cjs.map +1 -0
- package/dist/chunk-LF2ZLOFP.js +767 -0
- package/dist/chunk-LF2ZLOFP.js.map +1 -0
- package/dist/chunk-LYPU75T6.js +1147 -0
- package/dist/chunk-LYPU75T6.js.map +1 -0
- package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
- package/dist/chunk-MMROOK5J.js.map +1 -0
- package/dist/chunk-N35YCWQ5.cjs +540 -0
- package/dist/chunk-N35YCWQ5.cjs.map +1 -0
- package/dist/{chunk-LIVAK2DM.js → chunk-N7F33WAD.js} +1083 -794
- package/dist/chunk-N7F33WAD.js.map +1 -0
- package/dist/chunk-NG5IVLEZ.js +1012 -0
- package/dist/chunk-NG5IVLEZ.js.map +1 -0
- package/dist/chunk-NLWACBE7.cjs +128 -0
- package/dist/chunk-NLWACBE7.cjs.map +1 -0
- package/dist/chunk-OGW6HHVI.js +1408 -0
- package/dist/chunk-OGW6HHVI.js.map +1 -0
- package/dist/chunk-OJQOYXHU.cjs +15748 -0
- package/dist/chunk-OJQOYXHU.cjs.map +1 -0
- package/dist/chunk-OZLRIVC4.cjs +588 -0
- package/dist/chunk-OZLRIVC4.cjs.map +1 -0
- package/dist/chunk-P7CIEIJ3.js +925 -0
- package/dist/chunk-P7CIEIJ3.js.map +1 -0
- package/dist/chunk-P7RBMCBE.cjs +934 -0
- package/dist/chunk-P7RBMCBE.cjs.map +1 -0
- package/dist/chunk-PPYGWINI.cjs +2777 -0
- package/dist/chunk-PPYGWINI.cjs.map +1 -0
- package/dist/{chunk-P6SCPDYW.js → chunk-PUYSH3IL.js} +114 -137
- package/dist/chunk-PUYSH3IL.js.map +1 -0
- package/dist/{chunk-MHKNLNAN.cjs → chunk-PWTXZZTR.cjs} +33 -10
- package/dist/chunk-PWTXZZTR.cjs.map +1 -0
- package/dist/chunk-R7NOGUZG.js +65 -0
- package/dist/chunk-R7NOGUZG.js.map +1 -0
- package/dist/chunk-RCHEPTZZ.js +2006 -0
- package/dist/chunk-RCHEPTZZ.js.map +1 -0
- package/dist/chunk-RE4RPXT2.cjs +18 -0
- package/dist/chunk-RE4RPXT2.cjs.map +1 -0
- package/dist/chunk-SIGXR3JT.cjs +1043 -0
- package/dist/chunk-SIGXR3JT.cjs.map +1 -0
- package/dist/chunk-SPLSYTYW.cjs +88 -0
- package/dist/chunk-SPLSYTYW.cjs.map +1 -0
- package/dist/chunk-SQY4T6EJ.js +571 -0
- package/dist/chunk-SQY4T6EJ.js.map +1 -0
- package/dist/{chunk-TJKLBTFB.js → chunk-SYRRSBGL.js} +51 -27
- package/dist/chunk-SYRRSBGL.js.map +1 -0
- package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
- package/dist/chunk-T3TIA3O6.cjs.map +1 -0
- package/dist/{chunk-EJO45KYT.js → chunk-TTHEEIZ3.js} +53 -50
- package/dist/chunk-TTHEEIZ3.js.map +1 -0
- package/dist/chunk-TVSIG4JE.cjs +940 -0
- package/dist/chunk-TVSIG4JE.cjs.map +1 -0
- package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
- package/dist/chunk-WHN4VX55.js.map +1 -0
- package/dist/dist-26HWEQY6.js +3 -0
- package/dist/dist-26HWEQY6.js.map +1 -0
- package/dist/dist-3A5DXB37.cjs +20 -0
- package/dist/dist-3A5DXB37.cjs.map +1 -0
- package/dist/dist-3SJKQJGY.cjs +16 -0
- package/dist/dist-3SJKQJGY.cjs.map +1 -0
- package/dist/dist-4ZQSPE5K.js +3 -0
- package/dist/dist-4ZQSPE5K.js.map +1 -0
- package/dist/dist-5W5QNRTD.js +3 -0
- package/dist/dist-5W5QNRTD.js.map +1 -0
- package/dist/dist-653SRMPL.js +3 -0
- package/dist/dist-653SRMPL.js.map +1 -0
- package/dist/dist-6U6EFC5C.cjs +16 -0
- package/dist/dist-6U6EFC5C.cjs.map +1 -0
- package/dist/dist-7IHNNYMF.cjs +16 -0
- package/dist/dist-7IHNNYMF.cjs.map +1 -0
- package/dist/dist-B5IPRF6W.js +3 -0
- package/dist/dist-B5IPRF6W.js.map +1 -0
- package/dist/dist-EOMYFT4Y.cjs +16 -0
- package/dist/dist-EOMYFT4Y.cjs.map +1 -0
- package/dist/dist-EZZMMMNT.cjs +16 -0
- package/dist/dist-EZZMMMNT.cjs.map +1 -0
- package/dist/dist-F2ET4MNO.cjs +16 -0
- package/dist/dist-F2ET4MNO.cjs.map +1 -0
- package/dist/dist-H64VX6DE.js +3 -0
- package/dist/dist-H64VX6DE.js.map +1 -0
- package/dist/dist-HY7RMLJQ.cjs +16 -0
- package/dist/dist-HY7RMLJQ.cjs.map +1 -0
- package/dist/dist-M6S4P3FJ.js +3 -0
- package/dist/dist-M6S4P3FJ.js.map +1 -0
- package/dist/dist-NR7QSCQT.js +3 -0
- package/dist/dist-NR7QSCQT.js.map +1 -0
- package/dist/dist-QLFMCMCX.js +3 -0
- package/dist/dist-QLFMCMCX.js.map +1 -0
- package/dist/dist-UY46BFRP.js +3 -0
- package/dist/dist-UY46BFRP.js.map +1 -0
- package/dist/dist-WCQDRTIV.cjs +16 -0
- package/dist/dist-WCQDRTIV.cjs.map +1 -0
- package/dist/dist-WKYB3LTJ.cjs +16 -0
- package/dist/dist-WKYB3LTJ.cjs.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server/a2a/protocol.d.ts +8 -0
- package/dist/server/a2a/protocol.d.ts.map +1 -0
- package/dist/server/a2a/store.cjs +25 -0
- package/dist/server/a2a/store.cjs.map +1 -0
- package/dist/server/a2a/store.d.ts +14 -0
- package/dist/server/a2a/store.d.ts.map +1 -0
- package/dist/server/a2a/store.js +23 -0
- package/dist/server/a2a/store.js.map +1 -0
- package/dist/server/a2a/tasks.d.ts +20 -0
- package/dist/server/a2a/tasks.d.ts.map +1 -0
- package/dist/server/handlers/a2a.cjs +13 -11
- package/dist/server/handlers/a2a.cjs.map +1 -0
- package/dist/server/handlers/a2a.d.ts +68 -6
- package/dist/server/handlers/a2a.d.ts.map +1 -0
- package/dist/server/handlers/a2a.js +3 -1
- package/dist/server/handlers/a2a.js.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +68 -0
- package/dist/server/handlers/agent-builder.cjs.map +1 -0
- package/dist/server/handlers/agent-builder.d.ts +88 -0
- package/dist/server/handlers/agent-builder.d.ts.map +1 -0
- package/dist/server/handlers/agent-builder.js +3 -0
- package/dist/server/handlers/agent-builder.js.map +1 -0
- package/dist/server/handlers/agents.cjs +41 -7
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +139 -6
- package/dist/server/handlers/agents.d.ts.map +1 -0
- package/dist/server/handlers/agents.js +3 -1
- package/dist/server/handlers/agents.js.map +1 -0
- package/dist/server/handlers/error.cjs +4 -2
- package/dist/server/handlers/error.cjs.map +1 -0
- package/dist/server/handlers/error.d.ts +2 -1
- package/dist/server/handlers/error.d.ts.map +1 -0
- package/dist/server/handlers/error.js +3 -1
- package/dist/server/handlers/error.js.map +1 -0
- package/dist/server/handlers/legacyWorkflows.cjs +48 -0
- package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
- package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
- package/dist/server/handlers/legacyWorkflows.js +3 -0
- package/dist/server/handlers/legacyWorkflows.js.map +1 -0
- package/dist/server/handlers/logs.cjs +6 -4
- package/dist/server/handlers/logs.cjs.map +1 -0
- package/dist/server/handlers/logs.d.ts +34 -3
- package/dist/server/handlers/logs.d.ts.map +1 -0
- package/dist/server/handlers/logs.js +3 -1
- package/dist/server/handlers/logs.js.map +1 -0
- package/dist/server/handlers/memory.cjs +39 -9
- package/dist/server/handlers/memory.cjs.map +1 -0
- package/dist/server/handlers/memory.d.ts +118 -8
- package/dist/server/handlers/memory.d.ts.map +1 -0
- package/dist/server/handlers/memory.js +3 -1
- package/dist/server/handlers/memory.js.map +1 -0
- package/dist/server/handlers/observability.cjs +16 -0
- package/dist/server/handlers/observability.cjs.map +1 -0
- package/dist/server/handlers/observability.d.ts +23 -0
- package/dist/server/handlers/observability.d.ts.map +1 -0
- package/dist/server/handlers/observability.js +3 -0
- package/dist/server/handlers/observability.js.map +1 -0
- package/dist/server/handlers/scores.cjs +32 -0
- package/dist/server/handlers/scores.cjs.map +1 -0
- package/dist/server/handlers/scores.d.ts +49 -0
- package/dist/server/handlers/scores.d.ts.map +1 -0
- package/dist/server/handlers/scores.js +3 -0
- package/dist/server/handlers/scores.js.map +1 -0
- package/dist/server/handlers/telemetry.cjs +9 -3
- package/dist/server/handlers/telemetry.cjs.map +1 -0
- package/dist/server/handlers/telemetry.d.ts +33 -2
- package/dist/server/handlers/telemetry.d.ts.map +1 -0
- package/dist/server/handlers/telemetry.js +3 -1
- package/dist/server/handlers/telemetry.js.map +1 -0
- package/dist/server/handlers/tools.cjs +11 -5
- package/dist/server/handlers/tools.cjs.map +1 -0
- package/dist/server/handlers/tools.d.ts +25 -4
- package/dist/server/handlers/tools.d.ts.map +1 -0
- package/dist/server/handlers/tools.js +3 -1
- package/dist/server/handlers/tools.js.map +1 -0
- package/dist/server/handlers/utils.cjs +8 -2
- package/dist/server/handlers/utils.cjs.map +1 -0
- package/dist/server/handlers/utils.d.ts +8 -1
- package/dist/server/handlers/utils.d.ts.map +1 -0
- package/dist/server/handlers/utils.js +3 -1
- package/dist/server/handlers/utils.js.map +1 -0
- package/dist/server/handlers/vNextNetwork.cjs +220 -0
- package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
- package/dist/server/handlers/vNextNetwork.d.ts +246 -0
- package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
- package/dist/server/handlers/vNextNetwork.js +213 -0
- package/dist/server/handlers/vNextNetwork.js.map +1 -0
- package/dist/server/handlers/vector.cjs +9 -7
- package/dist/server/handlers/vector.cjs.map +1 -0
- package/dist/server/handlers/vector.d.ts +51 -6
- package/dist/server/handlers/vector.d.ts.map +1 -0
- package/dist/server/handlers/vector.js +3 -1
- package/dist/server/handlers/vector.js.map +1 -0
- package/dist/server/handlers/voice.cjs +10 -4
- package/dist/server/handlers/voice.cjs.map +1 -0
- package/dist/server/handlers/voice.d.ts +41 -3
- package/dist/server/handlers/voice.d.ts.map +1 -0
- package/dist/server/handlers/voice.js +3 -1
- package/dist/server/handlers/voice.js.map +1 -0
- package/dist/server/handlers/workflows.cjs +43 -13
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +82 -10
- package/dist/server/handlers/workflows.d.ts.map +1 -0
- package/dist/server/handlers/workflows.js +3 -1
- package/dist/server/handlers/workflows.js.map +1 -0
- package/dist/server/handlers.cjs +44 -32
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +14 -11
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +15 -11
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/http-exception.d.ts +87 -0
- package/dist/server/http-exception.d.ts.map +1 -0
- package/dist/server/types.d.ts +10 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils.d.ts +44 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/package.json +51 -21
- package/dist/_tsup-dts-rollup.d.cts +0 -816
- package/dist/_tsup-dts-rollup.d.ts +0 -816
- package/dist/chunk-57CJTIPW.cjs +0 -18
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-C7564HUT.js +0 -142
- package/dist/chunk-D4IRYCUI.cjs +0 -235
- package/dist/chunk-DJJIUEL2.js +0 -211
- package/dist/chunk-HWZVAG3H.js +0 -49
- package/dist/chunk-I2B73Y4I.cjs +0 -332
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-MIQYDLLM.js +0 -329
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-OGCNNUHF.cjs +0 -54
- package/dist/chunk-UCTEMO2Q.cjs +0 -341
- package/dist/chunk-VPNDC2DI.cjs +0 -148
- package/dist/chunk-WUC6LSTW.js +0 -227
- package/dist/chunk-Y7UWRW5X.cjs +0 -221
- package/dist/chunk-YBVOQN4M.cjs +0 -94
- package/dist/chunk-ZE5AAC4I.cjs +0 -138
- package/dist/index.d.cts +0 -1
- package/dist/server/handlers/a2a.d.cts +0 -6
- package/dist/server/handlers/agents.d.cts +0 -6
- package/dist/server/handlers/error.d.cts +0 -1
- package/dist/server/handlers/logs.d.cts +0 -3
- package/dist/server/handlers/memory.d.cts +0 -8
- package/dist/server/handlers/network.cjs +0 -22
- package/dist/server/handlers/network.d.cts +0 -4
- package/dist/server/handlers/network.d.ts +0 -4
- package/dist/server/handlers/network.js +0 -1
- package/dist/server/handlers/telemetry.d.cts +0 -2
- package/dist/server/handlers/tools.d.cts +0 -4
- package/dist/server/handlers/utils.d.cts +0 -1
- 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
- package/dist/server/handlers/vector.d.cts +0 -6
- package/dist/server/handlers/voice.d.cts +0 -3
- package/dist/server/handlers/workflows.d.cts +0 -10
- package/dist/server/handlers.d.cts +0 -11
package/dist/chunk-I2B73Y4I.cjs
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkYWLUOY3D_cjs = require('./chunk-YWLUOY3D.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
|
-
createRunHandler: () => createRunHandler,
|
|
13
|
-
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
14
|
-
getWorkflowRunHandler: () => getWorkflowRunHandler,
|
|
15
|
-
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
16
|
-
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
17
|
-
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
18
|
-
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
19
|
-
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
20
|
-
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
21
|
-
watchWorkflowHandler: () => watchWorkflowHandler
|
|
22
|
-
});
|
|
23
|
-
async function getWorkflowsHandler({ mastra }) {
|
|
24
|
-
try {
|
|
25
|
-
const workflows = mastra.getWorkflows({ serialized: false });
|
|
26
|
-
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
27
|
-
if (workflow.isNested) return acc;
|
|
28
|
-
acc[key] = {
|
|
29
|
-
stepGraph: workflow.stepGraph,
|
|
30
|
-
stepSubscriberGraph: workflow.stepSubscriberGraph,
|
|
31
|
-
serializedStepGraph: workflow.serializedStepGraph,
|
|
32
|
-
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
33
|
-
name: workflow.name,
|
|
34
|
-
triggerSchema: workflow.triggerSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
35
|
-
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
36
|
-
const _step = step;
|
|
37
|
-
acc2[key2] = {
|
|
38
|
-
id: _step.id,
|
|
39
|
-
description: _step.description,
|
|
40
|
-
workflowId: _step.workflowId,
|
|
41
|
-
inputSchema: _step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
42
|
-
outputSchema: _step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(_step.outputSchema)) : void 0
|
|
43
|
-
};
|
|
44
|
-
return acc2;
|
|
45
|
-
}, {})
|
|
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 getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
55
|
-
try {
|
|
56
|
-
if (!workflowId) {
|
|
57
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
58
|
-
}
|
|
59
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
60
|
-
if (!workflow) {
|
|
61
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
stepGraph: workflow.stepGraph,
|
|
65
|
-
stepSubscriberGraph: workflow.stepSubscriberGraph,
|
|
66
|
-
serializedStepGraph: workflow.serializedStepGraph,
|
|
67
|
-
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
68
|
-
name: workflow.name,
|
|
69
|
-
triggerSchema: workflow.triggerSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
70
|
-
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
71
|
-
const _step = step;
|
|
72
|
-
acc[key] = {
|
|
73
|
-
id: _step.id,
|
|
74
|
-
description: _step.description,
|
|
75
|
-
workflowId: _step.workflowId,
|
|
76
|
-
inputSchema: _step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
77
|
-
outputSchema: _step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(_step.outputSchema)) : void 0
|
|
78
|
-
};
|
|
79
|
-
return acc;
|
|
80
|
-
}, {})
|
|
81
|
-
};
|
|
82
|
-
} catch (error) {
|
|
83
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async function startAsyncWorkflowHandler({
|
|
87
|
-
mastra,
|
|
88
|
-
runtimeContext,
|
|
89
|
-
workflowId,
|
|
90
|
-
runId,
|
|
91
|
-
triggerData
|
|
92
|
-
}) {
|
|
93
|
-
try {
|
|
94
|
-
if (!workflowId) {
|
|
95
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
96
|
-
}
|
|
97
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
98
|
-
if (!workflow) {
|
|
99
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
100
|
-
}
|
|
101
|
-
if (!runId) {
|
|
102
|
-
const newRun = workflow.createRun();
|
|
103
|
-
const result2 = await newRun.start({
|
|
104
|
-
triggerData,
|
|
105
|
-
runtimeContext
|
|
106
|
-
});
|
|
107
|
-
return result2;
|
|
108
|
-
}
|
|
109
|
-
const run = workflow.getMemoryRun(runId);
|
|
110
|
-
if (!run) {
|
|
111
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
112
|
-
}
|
|
113
|
-
const result = await run.start({
|
|
114
|
-
triggerData,
|
|
115
|
-
runtimeContext
|
|
116
|
-
});
|
|
117
|
-
return result;
|
|
118
|
-
} catch (error) {
|
|
119
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
async function getWorkflowRunHandler({
|
|
123
|
-
mastra,
|
|
124
|
-
workflowId,
|
|
125
|
-
runId
|
|
126
|
-
}) {
|
|
127
|
-
try {
|
|
128
|
-
if (!workflowId) {
|
|
129
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
130
|
-
}
|
|
131
|
-
if (!runId) {
|
|
132
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
133
|
-
}
|
|
134
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
135
|
-
if (!workflow) {
|
|
136
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
137
|
-
}
|
|
138
|
-
const run = await workflow.getRun(runId);
|
|
139
|
-
if (!run) {
|
|
140
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
141
|
-
}
|
|
142
|
-
return run;
|
|
143
|
-
} catch (error) {
|
|
144
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
async function createRunHandler({
|
|
148
|
-
mastra,
|
|
149
|
-
workflowId,
|
|
150
|
-
runId: prevRunId
|
|
151
|
-
}) {
|
|
152
|
-
try {
|
|
153
|
-
if (!workflowId) {
|
|
154
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow 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 newRun = workflow.createRun({ runId: prevRunId });
|
|
161
|
-
return { runId: newRun.runId };
|
|
162
|
-
} catch (error) {
|
|
163
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
async function startWorkflowRunHandler({
|
|
167
|
-
mastra,
|
|
168
|
-
runtimeContext,
|
|
169
|
-
workflowId,
|
|
170
|
-
runId,
|
|
171
|
-
triggerData
|
|
172
|
-
}) {
|
|
173
|
-
try {
|
|
174
|
-
if (!workflowId) {
|
|
175
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
176
|
-
}
|
|
177
|
-
if (!runId) {
|
|
178
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
179
|
-
}
|
|
180
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
181
|
-
const run = workflow.getMemoryRun(runId);
|
|
182
|
-
if (!run) {
|
|
183
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
184
|
-
}
|
|
185
|
-
void run.start({
|
|
186
|
-
triggerData,
|
|
187
|
-
runtimeContext
|
|
188
|
-
});
|
|
189
|
-
return { message: "Workflow run started" };
|
|
190
|
-
} catch (e) {
|
|
191
|
-
return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
async function watchWorkflowHandler({
|
|
195
|
-
mastra,
|
|
196
|
-
workflowId,
|
|
197
|
-
runId
|
|
198
|
-
}) {
|
|
199
|
-
try {
|
|
200
|
-
if (!workflowId) {
|
|
201
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
202
|
-
}
|
|
203
|
-
if (!runId) {
|
|
204
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
205
|
-
}
|
|
206
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
207
|
-
const run = workflow.getMemoryRun(runId);
|
|
208
|
-
if (!run) {
|
|
209
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
210
|
-
}
|
|
211
|
-
let unwatch;
|
|
212
|
-
let asyncRef = null;
|
|
213
|
-
const stream = new web.ReadableStream({
|
|
214
|
-
start(controller) {
|
|
215
|
-
unwatch = run.watch(({ activePaths, runId: runId2, timestamp, results }) => {
|
|
216
|
-
const activePathsObj = Object.fromEntries(activePaths);
|
|
217
|
-
controller.enqueue(JSON.stringify({ activePaths: activePathsObj, runId: runId2, timestamp, results }));
|
|
218
|
-
if (asyncRef) {
|
|
219
|
-
clearImmediate(asyncRef);
|
|
220
|
-
asyncRef = null;
|
|
221
|
-
}
|
|
222
|
-
asyncRef = setImmediate(() => {
|
|
223
|
-
const runDone = Object.values(activePathsObj).every((value) => value.status !== "executing");
|
|
224
|
-
if (runDone) {
|
|
225
|
-
controller.close();
|
|
226
|
-
unwatch?.();
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
cancel() {
|
|
232
|
-
unwatch?.();
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
return stream;
|
|
236
|
-
} catch (error) {
|
|
237
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
async function resumeAsyncWorkflowHandler({
|
|
241
|
-
mastra,
|
|
242
|
-
workflowId,
|
|
243
|
-
runId,
|
|
244
|
-
body,
|
|
245
|
-
runtimeContext
|
|
246
|
-
}) {
|
|
247
|
-
try {
|
|
248
|
-
if (!workflowId) {
|
|
249
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
250
|
-
}
|
|
251
|
-
if (!runId) {
|
|
252
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
253
|
-
}
|
|
254
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
255
|
-
const run = workflow.getMemoryRun(runId);
|
|
256
|
-
if (!run) {
|
|
257
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
258
|
-
}
|
|
259
|
-
const result = await run.resume({
|
|
260
|
-
stepId: body.stepId,
|
|
261
|
-
context: body.context,
|
|
262
|
-
runtimeContext
|
|
263
|
-
});
|
|
264
|
-
return result;
|
|
265
|
-
} catch (error) {
|
|
266
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
async function resumeWorkflowHandler({
|
|
270
|
-
mastra,
|
|
271
|
-
workflowId,
|
|
272
|
-
runId,
|
|
273
|
-
body,
|
|
274
|
-
runtimeContext
|
|
275
|
-
}) {
|
|
276
|
-
try {
|
|
277
|
-
if (!workflowId) {
|
|
278
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
279
|
-
}
|
|
280
|
-
if (!runId) {
|
|
281
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
282
|
-
}
|
|
283
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
284
|
-
const run = workflow.getMemoryRun(runId);
|
|
285
|
-
if (!run) {
|
|
286
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
287
|
-
}
|
|
288
|
-
void run.resume({
|
|
289
|
-
stepId: body.stepId,
|
|
290
|
-
context: body.context,
|
|
291
|
-
runtimeContext
|
|
292
|
-
});
|
|
293
|
-
return { message: "Workflow run resumed" };
|
|
294
|
-
} catch (error) {
|
|
295
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
async function getWorkflowRunsHandler({
|
|
299
|
-
mastra,
|
|
300
|
-
workflowId,
|
|
301
|
-
fromDate,
|
|
302
|
-
toDate,
|
|
303
|
-
limit,
|
|
304
|
-
offset,
|
|
305
|
-
resourceId
|
|
306
|
-
}) {
|
|
307
|
-
try {
|
|
308
|
-
if (!workflowId) {
|
|
309
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
310
|
-
}
|
|
311
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
312
|
-
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
313
|
-
runs: [],
|
|
314
|
-
total: 0
|
|
315
|
-
};
|
|
316
|
-
return workflowRuns;
|
|
317
|
-
} catch (error) {
|
|
318
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
exports.createRunHandler = createRunHandler;
|
|
323
|
-
exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
|
|
324
|
-
exports.getWorkflowRunHandler = getWorkflowRunHandler;
|
|
325
|
-
exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
|
|
326
|
-
exports.getWorkflowsHandler = getWorkflowsHandler;
|
|
327
|
-
exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
|
|
328
|
-
exports.resumeWorkflowHandler = resumeWorkflowHandler;
|
|
329
|
-
exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
|
|
330
|
-
exports.startWorkflowRunHandler = startWorkflowRunHandler;
|
|
331
|
-
exports.watchWorkflowHandler = watchWorkflowHandler;
|
|
332
|
-
exports.workflows_exports = workflows_exports;
|
package/dist/chunk-M5ABIP7D.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
2
|
-
|
|
3
|
-
// src/server/handlers/error.ts
|
|
4
|
-
function handleError(error, defaultMessage) {
|
|
5
|
-
const apiError = error;
|
|
6
|
-
throw new HTTPException(apiError.status || 500, {
|
|
7
|
-
message: apiError.message || defaultMessage
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { handleError };
|
package/dist/chunk-MIQYDLLM.js
DELETED
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-LIVAK2DM.js';
|
|
2
|
-
import { handleError } from './chunk-M5ABIP7D.js';
|
|
3
|
-
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
4
|
-
import { __export } from './chunk-MLKGABMK.js';
|
|
5
|
-
import { ReadableStream } from 'node:stream/web';
|
|
6
|
-
import { RuntimeContext } from '@mastra/core/di';
|
|
7
|
-
|
|
8
|
-
// src/server/handlers/vNextWorkflows.ts
|
|
9
|
-
var vNextWorkflows_exports = {};
|
|
10
|
-
__export(vNextWorkflows_exports, {
|
|
11
|
-
createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
|
|
12
|
-
getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
|
|
13
|
-
getVNextWorkflowRunByIdHandler: () => getVNextWorkflowRunByIdHandler,
|
|
14
|
-
getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
|
|
15
|
-
getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
|
|
16
|
-
resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
|
|
17
|
-
resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
|
|
18
|
-
startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
|
|
19
|
-
startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
|
|
20
|
-
watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
|
|
21
|
-
});
|
|
22
|
-
async function getVNextWorkflowsHandler({ mastra }) {
|
|
23
|
-
try {
|
|
24
|
-
const workflows = mastra.vnext_getWorkflows({ serialized: false });
|
|
25
|
-
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
26
|
-
acc[key] = {
|
|
27
|
-
name: workflow.name,
|
|
28
|
-
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
29
|
-
acc2[key2] = {
|
|
30
|
-
id: step.id,
|
|
31
|
-
description: step.description,
|
|
32
|
-
inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
|
|
33
|
-
outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
|
|
34
|
-
resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
|
|
35
|
-
suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
|
|
36
|
-
};
|
|
37
|
-
return acc2;
|
|
38
|
-
}, {}),
|
|
39
|
-
stepGraph: workflow.serializedStepGraph,
|
|
40
|
-
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
41
|
-
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
42
|
-
};
|
|
43
|
-
return acc;
|
|
44
|
-
}, {});
|
|
45
|
-
return _workflows;
|
|
46
|
-
} catch (error) {
|
|
47
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
51
|
-
try {
|
|
52
|
-
if (!workflowId) {
|
|
53
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
54
|
-
}
|
|
55
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
56
|
-
if (!workflow) {
|
|
57
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
61
|
-
acc[key] = {
|
|
62
|
-
id: step.id,
|
|
63
|
-
description: step.description,
|
|
64
|
-
inputSchema: step.inputSchema ? stringify(esm_default(step.inputSchema)) : void 0,
|
|
65
|
-
outputSchema: step.outputSchema ? stringify(esm_default(step.outputSchema)) : void 0,
|
|
66
|
-
resumeSchema: step.resumeSchema ? stringify(esm_default(step.resumeSchema)) : void 0,
|
|
67
|
-
suspendSchema: step.suspendSchema ? stringify(esm_default(step.suspendSchema)) : void 0
|
|
68
|
-
};
|
|
69
|
-
return acc;
|
|
70
|
-
}, {}),
|
|
71
|
-
name: workflow.name,
|
|
72
|
-
stepGraph: workflow.serializedStepGraph,
|
|
73
|
-
inputSchema: workflow.inputSchema ? stringify(esm_default(workflow.inputSchema)) : void 0,
|
|
74
|
-
outputSchema: workflow.outputSchema ? stringify(esm_default(workflow.outputSchema)) : void 0
|
|
75
|
-
};
|
|
76
|
-
} catch (error) {
|
|
77
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
async function getVNextWorkflowRunByIdHandler({
|
|
81
|
-
mastra,
|
|
82
|
-
workflowId,
|
|
83
|
-
runId
|
|
84
|
-
}) {
|
|
85
|
-
try {
|
|
86
|
-
if (!workflowId) {
|
|
87
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
88
|
-
}
|
|
89
|
-
if (!runId) {
|
|
90
|
-
throw new HTTPException(400, { message: "Run ID is required" });
|
|
91
|
-
}
|
|
92
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
93
|
-
if (!workflow) {
|
|
94
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
95
|
-
}
|
|
96
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
97
|
-
if (!run) {
|
|
98
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
99
|
-
}
|
|
100
|
-
return run;
|
|
101
|
-
} catch (error) {
|
|
102
|
-
throw new HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async function createVNextWorkflowRunHandler({
|
|
106
|
-
mastra,
|
|
107
|
-
workflowId,
|
|
108
|
-
runId: prevRunId
|
|
109
|
-
}) {
|
|
110
|
-
try {
|
|
111
|
-
if (!workflowId) {
|
|
112
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
113
|
-
}
|
|
114
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
115
|
-
if (!workflow) {
|
|
116
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
117
|
-
}
|
|
118
|
-
const run = workflow.createRun({ runId: prevRunId });
|
|
119
|
-
return { runId: run.runId };
|
|
120
|
-
} catch (error) {
|
|
121
|
-
throw new HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
async function startAsyncVNextWorkflowHandler({
|
|
125
|
-
mastra,
|
|
126
|
-
runtimeContext,
|
|
127
|
-
workflowId,
|
|
128
|
-
runId,
|
|
129
|
-
inputData,
|
|
130
|
-
runtimeContextFromRequest
|
|
131
|
-
}) {
|
|
132
|
-
try {
|
|
133
|
-
if (!workflowId) {
|
|
134
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
135
|
-
}
|
|
136
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
137
|
-
if (!workflow) {
|
|
138
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
139
|
-
}
|
|
140
|
-
const finalRuntimeContext = new RuntimeContext([
|
|
141
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
142
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
143
|
-
]);
|
|
144
|
-
const _run = workflow.createRun({ runId });
|
|
145
|
-
const result = await _run.start({
|
|
146
|
-
inputData,
|
|
147
|
-
runtimeContext: finalRuntimeContext
|
|
148
|
-
});
|
|
149
|
-
return result;
|
|
150
|
-
} catch (error) {
|
|
151
|
-
throw new HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async function startVNextWorkflowRunHandler({
|
|
155
|
-
mastra,
|
|
156
|
-
runtimeContext,
|
|
157
|
-
workflowId,
|
|
158
|
-
runId,
|
|
159
|
-
inputData,
|
|
160
|
-
runtimeContextFromRequest
|
|
161
|
-
}) {
|
|
162
|
-
try {
|
|
163
|
-
if (!workflowId) {
|
|
164
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
165
|
-
}
|
|
166
|
-
if (!runId) {
|
|
167
|
-
throw new HTTPException(400, { message: "runId required to start run" });
|
|
168
|
-
}
|
|
169
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
170
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
171
|
-
if (!run) {
|
|
172
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
173
|
-
}
|
|
174
|
-
const finalRuntimeContext = new RuntimeContext([
|
|
175
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
176
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
177
|
-
]);
|
|
178
|
-
const _run = workflow.createRun({ runId });
|
|
179
|
-
void _run.start({
|
|
180
|
-
inputData,
|
|
181
|
-
runtimeContext: finalRuntimeContext
|
|
182
|
-
});
|
|
183
|
-
return { message: "Workflow run started" };
|
|
184
|
-
} catch (e) {
|
|
185
|
-
return handleError(e, "Error starting workflow run");
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
async function watchVNextWorkflowHandler({
|
|
189
|
-
mastra,
|
|
190
|
-
workflowId,
|
|
191
|
-
runId
|
|
192
|
-
}) {
|
|
193
|
-
try {
|
|
194
|
-
if (!workflowId) {
|
|
195
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
196
|
-
}
|
|
197
|
-
if (!runId) {
|
|
198
|
-
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
199
|
-
}
|
|
200
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
201
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
202
|
-
if (!run) {
|
|
203
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
204
|
-
}
|
|
205
|
-
const _run = workflow.createRun({ runId });
|
|
206
|
-
let unwatch;
|
|
207
|
-
let asyncRef = null;
|
|
208
|
-
const stream = new ReadableStream({
|
|
209
|
-
start(controller) {
|
|
210
|
-
unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
|
|
211
|
-
controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
|
|
212
|
-
if (asyncRef) {
|
|
213
|
-
clearImmediate(asyncRef);
|
|
214
|
-
asyncRef = null;
|
|
215
|
-
}
|
|
216
|
-
asyncRef = setImmediate(async () => {
|
|
217
|
-
const runDone = payload.workflowState.status !== "running";
|
|
218
|
-
if (runDone) {
|
|
219
|
-
controller.close();
|
|
220
|
-
unwatch?.();
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
},
|
|
225
|
-
cancel() {
|
|
226
|
-
unwatch?.();
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
return stream;
|
|
230
|
-
} catch (error) {
|
|
231
|
-
return handleError(error, "Error watching workflow");
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
async function resumeAsyncVNextWorkflowHandler({
|
|
235
|
-
mastra,
|
|
236
|
-
workflowId,
|
|
237
|
-
runId,
|
|
238
|
-
body,
|
|
239
|
-
runtimeContext,
|
|
240
|
-
runtimeContextFromRequest
|
|
241
|
-
}) {
|
|
242
|
-
try {
|
|
243
|
-
if (!workflowId) {
|
|
244
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
245
|
-
}
|
|
246
|
-
if (!runId) {
|
|
247
|
-
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
248
|
-
}
|
|
249
|
-
if (!body.step) {
|
|
250
|
-
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
251
|
-
}
|
|
252
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
253
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
254
|
-
if (!run) {
|
|
255
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
256
|
-
}
|
|
257
|
-
const finalRuntimeContext = new RuntimeContext([
|
|
258
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
259
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
260
|
-
]);
|
|
261
|
-
const _run = workflow.createRun({ runId });
|
|
262
|
-
const result = await _run.resume({
|
|
263
|
-
step: body.step,
|
|
264
|
-
resumeData: body.resumeData,
|
|
265
|
-
runtimeContext: finalRuntimeContext
|
|
266
|
-
});
|
|
267
|
-
return result;
|
|
268
|
-
} catch (error) {
|
|
269
|
-
return handleError(error, "Error resuming workflow step");
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
async function resumeVNextWorkflowHandler({
|
|
273
|
-
mastra,
|
|
274
|
-
workflowId,
|
|
275
|
-
runId,
|
|
276
|
-
body,
|
|
277
|
-
runtimeContext
|
|
278
|
-
}) {
|
|
279
|
-
try {
|
|
280
|
-
if (!workflowId) {
|
|
281
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
282
|
-
}
|
|
283
|
-
if (!runId) {
|
|
284
|
-
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
285
|
-
}
|
|
286
|
-
if (!body.step) {
|
|
287
|
-
throw new HTTPException(400, { message: "step required to resume workflow" });
|
|
288
|
-
}
|
|
289
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
290
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
291
|
-
if (!run) {
|
|
292
|
-
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
293
|
-
}
|
|
294
|
-
const _run = workflow.createRun({ runId });
|
|
295
|
-
void _run.resume({
|
|
296
|
-
step: body.step,
|
|
297
|
-
resumeData: body.resumeData,
|
|
298
|
-
runtimeContext
|
|
299
|
-
});
|
|
300
|
-
return { message: "Workflow run resumed" };
|
|
301
|
-
} catch (error) {
|
|
302
|
-
return handleError(error, "Error resuming workflow");
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
async function getVNextWorkflowRunsHandler({
|
|
306
|
-
mastra,
|
|
307
|
-
workflowId,
|
|
308
|
-
fromDate,
|
|
309
|
-
toDate,
|
|
310
|
-
limit,
|
|
311
|
-
offset,
|
|
312
|
-
resourceId
|
|
313
|
-
}) {
|
|
314
|
-
try {
|
|
315
|
-
if (!workflowId) {
|
|
316
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
317
|
-
}
|
|
318
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
319
|
-
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
320
|
-
runs: [],
|
|
321
|
-
total: 0
|
|
322
|
-
};
|
|
323
|
-
return workflowRuns;
|
|
324
|
-
} catch (error) {
|
|
325
|
-
return handleError(error, "Error getting workflow runs");
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export { createVNextWorkflowRunHandler, getVNextWorkflowByIdHandler, getVNextWorkflowRunByIdHandler, getVNextWorkflowRunsHandler, getVNextWorkflowsHandler, resumeAsyncVNextWorkflowHandler, resumeVNextWorkflowHandler, startAsyncVNextWorkflowHandler, startVNextWorkflowRunHandler, vNextWorkflows_exports, watchVNextWorkflowHandler };
|