2024-06-09 00:42:51 +05:30
|
|
|
/**
|
|
|
|
|
* RESTful API endpoints handling currently generated workflow management.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { Router } from 'express';
|
|
|
|
|
import logger from "../logger";
|
|
|
|
|
import { browserPool } from "../server";
|
|
|
|
|
import { readFile } from "../workflow-management/storage";
|
|
|
|
|
|
|
|
|
|
export const router = Router();
|
|
|
|
|
|
2024-06-09 00:43:11 +05:30
|
|
|
/**
|
|
|
|
|
* Logs information about workflow API.
|
|
|
|
|
*/
|
|
|
|
|
router.all('/', (req, res, next) => {
|
|
|
|
|
logger.log('debug',`The workflow API was invoked: ${req.url}`)
|
|
|
|
|
next() // pass control to the next handler
|
|
|
|
|
})
|
2024-06-09 00:43:46 +05:30
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GET endpoint for a recording linked to a remote browser instance.
|
|
|
|
|
* returns session's id
|
|
|
|
|
*/
|
|
|
|
|
router.get('/:browserId', (req, res) => {
|
|
|
|
|
const activeBrowser = browserPool.getRemoteBrowser(req.params.browserId);
|
|
|
|
|
let workflowFile = null;
|
|
|
|
|
if (activeBrowser && activeBrowser.generator) {
|
|
|
|
|
workflowFile = activeBrowser.generator.getWorkflowFile();
|
|
|
|
|
}
|
|
|
|
|
return res.send(workflowFile);
|
|
|
|
|
});
|
|
|
|
|
|