File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,18 +245,10 @@ class Engine {
245245 /**
246246 * Returns whether the given process version is currently deployed in the NeoBPMN Engine
247247 *
248- * @param {string } definitionId the id of the process definition
249248 * @param {string } versionId the version of the process to check
250249 * @returns {boolean } true if the version is deployed, false if it is known but not active
251- * @throws {Error } if the version has never been deployed to this engine
252250 */
253- async isProcessVersionDeployed ( definitionId , versionId ) {
254- try {
255- await distribution . db . getProcessVersion ( definitionId , versionId ) ;
256- } catch {
257- throw new Error ( `Version ${ versionId } has never been deployed to this engine.` ) ;
258- }
259-
251+ async isProcessVersionDeployed ( versionId ) {
260252 return this . _versionProcessMapping [ versionId ] ?. isDeployed ( ) ?? false ;
261253 }
262254
Original file line number Diff line number Diff line change @@ -463,30 +463,25 @@ module.exports = (path, management) => {
463463
464464 network . get ( `${ path } /:definitionId/versions/:version/active` , { cors : true } , async ( req ) => {
465465 const { definitionId, version } = req . params ;
466- const engine = management . getEngineWithDefinitionId ( definitionId ) ;
467-
468- if ( ! engine ) {
469- return {
470- statusCode : 200 ,
471- mimeType : 'application/json' ,
472- response : JSON . stringify ( { active : false } ) ,
473- } ;
474- }
475466
476467 try {
477- return {
478- statusCode : 200 ,
479- mimeType : 'application/json' ,
480- response : JSON . stringify ( {
481- active : await engine . isProcessVersionDeployed ( definitionId , version ) ,
482- } ) ,
483- } ;
484- } catch ( _ ) {
468+ await db . getProcessVersion ( definitionId , version ) ;
469+ } catch {
485470 return {
486471 statusCode : 404 ,
487472 mimeType : 'text/plain' ,
488473 response : 'The requested version is not found in this engine.' ,
489474 } ;
490475 }
476+
477+ const engine = management . getEngineWithDefinitionId ( definitionId ) ;
478+
479+ return {
480+ statusCode : 200 ,
481+ mimeType : 'application/json' ,
482+ response : JSON . stringify ( {
483+ active : engine ? await engine . isProcessVersionDeployed ( version ) : false ,
484+ } ) ,
485+ } ;
491486 } ) ;
492487} ;
You can’t perform that action at this time.
0 commit comments