@5minds/node-red-contrib-processcube
Advanced tools
Comparing version 1.7.4-feature-6f3b75-m6ksn7zb to 1.7.4-feature-6f3f78-m6l0ykww
@@ -25,3 +25,3 @@ { | ||
}, | ||
"menu-menu-item-sidebar": false, | ||
"menu-menu-item-sidebar": true, | ||
"menu-menu-item-palette": true, | ||
@@ -28,0 +28,0 @@ "do": { |
@@ -1,2 +0,1 @@ | ||
// let cause of merge custom settings | ||
@@ -9,3 +8,3 @@ | ||
} catch (e) { | ||
console.log(">>>", e); | ||
console.log('>>>', e); | ||
} | ||
@@ -19,4 +18,4 @@ | ||
console.error(`Unhandled Rejection at ${promise} reason: ${reason}`, {}); | ||
}); | ||
}); | ||
module.exports = config; |
@@ -386,3 +386,3 @@ /** | ||
title: ' powers by Node-RED', | ||
image: "/data/static/ProcessCube_Logo.svg", | ||
image: '/data/static/ProcessCube_Logo.svg', | ||
url: 'https://processcube.io', // optional url to make the header text/image a link to this url | ||
@@ -389,0 +389,0 @@ }, |
@@ -9,82 +9,84 @@ const Mustache = require('mustache'); | ||
SwaggerParser.dereference('http://localhost:56100/atlas_engine/api/v1/swagger') | ||
//SwaggerParser.dereference(swaggerFilename) | ||
.then((swaggerJson) => { | ||
console.log('Dereferenced API:', swaggerJson); | ||
SwaggerParser.dereference("http://localhost:56100/atlas_engine/api/v1/swagger") | ||
//SwaggerParser.dereference(swaggerFilename) | ||
.then(swaggerJson => { | ||
console.log('Dereferenced API:', swaggerJson); | ||
const apiPaths = [ | ||
{ | ||
'ProcessInstance Query': { | ||
path: '/process_instances/query', | ||
method: 'get', | ||
}, | ||
'UserTasks Input': { | ||
path: '/process_instances/query', | ||
method: 'get', | ||
}, | ||
'Wait for UserTask': { | ||
path: '/process_instances/query', | ||
method: 'get', | ||
}, | ||
'UserTask Event Listener': { | ||
path: '/process_instances/query', | ||
method: 'get', | ||
}, | ||
}, | ||
]; | ||
const apiPaths = [{ | ||
"ProcessInstance Query": { | ||
"path": "/process_instances/query", | ||
"method": "get" | ||
}, | ||
"UserTasks Input": { | ||
"path": "/process_instances/query", | ||
"method": "get" | ||
}, | ||
"Wait for UserTask": { | ||
"path": "/process_instances/query", | ||
"method": "get" | ||
}, | ||
"UserTask Event Listener": { | ||
"path": "/process_instances/query", | ||
"method": "get" | ||
} | ||
}]; | ||
apiPaths.forEach((apiEntry) => { | ||
console.log('API Entry:', apiEntry); | ||
console.log('API Entry Keys:', Object.keys(apiEntry)); | ||
apiPaths.forEach(apiEntry => { | ||
console.log('API Entry:', apiEntry); | ||
console.log('API Entry Keys:', Object.keys(apiEntry)); | ||
Object.keys(apiEntry).forEach((apiName) => { | ||
console.log('API Name:', apiName); | ||
console.log('API Data:', apiEntry[apiName]); | ||
Object.keys(apiEntry).forEach(apiName => { | ||
console.log('API Name:', apiName); | ||
console.log('API Data:', apiEntry[apiName]); | ||
let apiPath = apiEntry[apiName].path; // Die API-Route, die du dokumentieren möchtest | ||
let apiPath = apiEntry[apiName].path; // Die API-Route, die du dokumentieren möchtest | ||
//let apiPath = '/process_instances/query'; // Die API-Route, die du dokumentieren möchtest | ||
const routeData = swaggerJson.paths[apiPath]; | ||
//let apiPath = '/process_instances/query'; // Die API-Route, die du dokumentieren möchtest | ||
const routeData = swaggerJson.paths[apiPath]; | ||
if (routeData) { | ||
console.log(`Details for ${apiPath}:`, routeData); | ||
} else { | ||
console.error(`Route ${apiPath} not found in Swagger documentation.`); | ||
} | ||
let description = routeData[Object.keys(routeData)[0]].description; | ||
if (routeData) { | ||
console.log(`Details for ${apiPath}:`, routeData); | ||
} else { | ||
console.error(`Route ${apiPath} not found in Swagger documentation.`); | ||
} | ||
description = `Filter result for '${apiName}'`; | ||
let description = routeData[Object.keys(routeData)[0]].description; | ||
// API-Route-Information vorbereiten | ||
const apiRouteData = { | ||
path: apiPath, | ||
method: Object.keys(routeData)[0], // z.B. GET, POST, etc. | ||
summary: routeData[Object.keys(routeData)[0]].summary, | ||
description: description, | ||
parameters: routeData[Object.keys(routeData)[0]].parameters || [], | ||
responses: Object.entries(routeData[Object.keys(routeData)[0]].responses).map(([status, response]) => ({ | ||
status, | ||
description: response.description | ||
})) | ||
}; | ||
// Mustache-Template einlesen | ||
const template = fs.readFileSync('query_template.mustache', 'utf-8'); | ||
// Mustache-Rendering | ||
const output = Mustache.render(template, apiRouteData); | ||
// Ausgabe in eine Datei schreiben oder anzeigen | ||
//console.log(output); | ||
const outputFilename = apiName.replace(/\/ /g, '_') + '.md'; | ||
console.log(`Writing output to ${outputFilename}`); | ||
fs.writeFileSync(`outputs/${outputFilename}`, output); | ||
description = `Filter result for '${apiName}'`; | ||
// API-Route-Information vorbereiten | ||
const apiRouteData = { | ||
path: apiPath, | ||
method: Object.keys(routeData)[0], // z.B. GET, POST, etc. | ||
summary: routeData[Object.keys(routeData)[0]].summary, | ||
description: description, | ||
parameters: routeData[Object.keys(routeData)[0]].parameters || [], | ||
responses: Object.entries(routeData[Object.keys(routeData)[0]].responses).map( | ||
([status, response]) => ({ | ||
status, | ||
description: response.description, | ||
}), | ||
), | ||
}; | ||
// Mustache-Template einlesen | ||
const template = fs.readFileSync('query_template.mustache', 'utf-8'); | ||
// Mustache-Rendering | ||
const output = Mustache.render(template, apiRouteData); | ||
// Ausgabe in eine Datei schreiben oder anzeigen | ||
//console.log(output); | ||
const outputFilename = apiName.replace(/\/ /g, '_') + '.md'; | ||
console.log(`Writing output to ${outputFilename}`); | ||
fs.writeFileSync(`outputs/${outputFilename}`, output); | ||
}); | ||
}); | ||
}) | ||
.catch((err) => { | ||
console.error('Dereferencing failed:', err); | ||
}); | ||
}) | ||
.catch(err => { | ||
console.error('Dereferencing failed:', err); | ||
}); |
const Mustache = require('mustache'); | ||
const fs = require('fs'); | ||
const swaggerFilename = '../../ProcessCube.Engine/docs/swagger/swagger.json'; // Dateiname der Swagger-Datei | ||
const swaggerFilename = '../../ProcessCube.Engine/docs/swagger/swagger.json'; // Dateiname der Swagger-Datei | ||
@@ -11,3 +11,3 @@ const swaggerJson = JSON.parse(fs.readFileSync(swaggerFilename, 'utf-8')); | ||
const apiPath = '/process_instances/query'; // Die API-Route, die du dokumentieren möchtest | ||
const apiPath = '/process_instances/query'; // Die API-Route, die du dokumentieren möchtest | ||
const routeData = swaggerJson.paths[apiPath]; | ||
@@ -24,3 +24,3 @@ | ||
path: apiPath, | ||
method: Object.keys(routeData)[0], // z.B. GET, POST, etc. | ||
method: Object.keys(routeData)[0], // z.B. GET, POST, etc. | ||
summary: routeData[Object.keys(routeData)[0]].summary, | ||
@@ -31,4 +31,4 @@ description: routeData[Object.keys(routeData)[0]].description, | ||
status, | ||
description: response.description | ||
})) | ||
description: response.description, | ||
})), | ||
}; | ||
@@ -35,0 +35,0 @@ |
@@ -15,4 +15,4 @@ module.exports = function (RED) { | ||
eventEmitter = flowContext.get('emitter'); | ||
} | ||
} | ||
const flowNodeInstanceId = msg.flowNodeInstanceId; | ||
@@ -33,3 +33,5 @@ | ||
node.log(`handle-${flowNodeInstanceId}: *flowNodeInstanceId* '${flowNodeInstanceId}' with *msg._msgid* '${msg._msgid}'`); | ||
node.log( | ||
`handle-${flowNodeInstanceId}: *flowNodeInstanceId* '${flowNodeInstanceId}' with *msg._msgid* '${msg._msgid}'`, | ||
); | ||
@@ -36,0 +38,0 @@ eventEmitter.emit(`handle-${flowNodeInstanceId}`, error, true); |
@@ -13,3 +13,2 @@ const EventEmitter = require('node:events'); | ||
module.exports = function (RED) { | ||
@@ -23,3 +22,2 @@ function ExternalTaskInput(config) { | ||
node.engine = RED.nodes.getNode(config.engine); | ||
@@ -67,3 +65,3 @@ | ||
node.log( | ||
`handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* ${externalTask.processInstanceId} with result ${JSON.stringify(result)} on msg._msgid ${msg._msgid}.` | ||
`handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* ${externalTask.processInstanceId} with result ${JSON.stringify(result)} on msg._msgid ${msg._msgid}.`, | ||
); | ||
@@ -83,3 +81,3 @@ | ||
node.log( | ||
`handle error event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${msg._msgid}'.` | ||
`handle error event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${msg._msgid}'.`, | ||
); | ||
@@ -102,3 +100,3 @@ | ||
node.log( | ||
`handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}' and *isError* '${isError}'` | ||
`handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}' and *isError* '${isError}'`, | ||
); | ||
@@ -126,3 +124,3 @@ | ||
node.log( | ||
`Received *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}'` | ||
`Received *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}'`, | ||
); | ||
@@ -135,3 +133,3 @@ | ||
let options = RED.util.evaluateNodeProperty(config.workerConfig, config.workerConfigType, node); | ||
let topic = RED.util.evaluateNodeProperty(config.topic, config.topicType, node) | ||
let topic = RED.util.evaluateNodeProperty(config.topic, config.topicType, node); | ||
@@ -156,3 +154,3 @@ client.externalTasks | ||
`Worker error ${errorType} for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}': ${error.message}`, | ||
{} | ||
{}, | ||
); | ||
@@ -159,0 +157,0 @@ |
@@ -15,3 +15,3 @@ module.exports = function (RED) { | ||
eventEmitter = flowContext.get('emitter'); | ||
} | ||
} | ||
@@ -18,0 +18,0 @@ const flowNodeInstanceId = msg.flowNodeInstanceId; |
@@ -9,3 +9,3 @@ module.exports = function (RED) { | ||
const client = node.engine.engineClient; | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -22,3 +22,3 @@ | ||
payload: msg.payload, | ||
identity: userIdentity | ||
identity: userIdentity, | ||
}) | ||
@@ -25,0 +25,0 @@ .then((result) => { |
{ | ||
"name": "@5minds/node-red-contrib-processcube", | ||
"version": "1.7.4-feature-6f3b75-m6ksn7zb", | ||
"version": "1.7.4-feature-6f3f78-m6l0ykww", | ||
"license": "MIT", | ||
@@ -71,3 +71,6 @@ "description": "Node-RED nodes for ProcessCube", | ||
"low-code" | ||
] | ||
], | ||
"devDependencies": { | ||
"prettier": "^3.4.2" | ||
} | ||
} |
@@ -56,3 +56,2 @@ module.exports = function (RED) { | ||
} | ||
}); | ||
@@ -296,3 +295,3 @@ case 'started': | ||
node.log( | ||
'processNotification (is-executable-changed): ' + JSON.stringify(processNotification) | ||
'processNotification (is-executable-changed): ' + JSON.stringify(processNotification), | ||
); | ||
@@ -299,0 +298,0 @@ |
@@ -15,5 +15,5 @@ module.exports = function (RED) { | ||
delete initialToken.msg; | ||
delete initialToken.format; | ||
delete initialToken.format; | ||
} | ||
} | ||
} | ||
@@ -44,3 +44,3 @@ const startParameters = { | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -47,0 +47,0 @@ |
@@ -9,3 +9,3 @@ module.exports = function (RED) { | ||
const client = node.engine.engineClient; | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -12,0 +12,0 @@ |
@@ -9,3 +9,3 @@ module.exports = function (RED) { | ||
const client = node.engine.engineClient; | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -17,3 +17,3 @@ | ||
} | ||
client.processDefinitions | ||
@@ -20,0 +20,0 @@ .persistProcessDefinitions(msg.payload, { overwriteExisting: true, identity: userIdentity }) |
@@ -19,3 +19,3 @@ module.exports = function (RED) { | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -22,0 +22,0 @@ query.identity = identity; |
@@ -10,3 +10,3 @@ module.exports = function (RED) { | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -41,3 +41,3 @@ | ||
const deletionDate = new Date(Date.now() - timeToUse * multiplier * 60 * 60 * 1000); | ||
const deletionDate = new Date(Date.now() - timeToUse * multiplier * 60 * 60 * 1000); | ||
@@ -72,6 +72,6 @@ const modelId = msg.payload.processModelId?.trim() || config.modelid?.trim(); | ||
}, | ||
{ | ||
{ | ||
includeXml: false, | ||
identity: userIdentity | ||
} | ||
identity: userIdentity, | ||
}, | ||
); | ||
@@ -81,3 +81,6 @@ | ||
if (processInstances.length === 0) { | ||
node.log(`No more process instances to delete for Model-ID: ${modelId} with Date: ${deletionDate.toISOString()}`, msg); | ||
node.log( | ||
`No more process instances to delete for Model-ID: ${modelId} with Date: ${deletionDate.toISOString()}`, | ||
msg, | ||
); | ||
hasMoreResults = false; | ||
@@ -92,3 +95,3 @@ continue; | ||
msg.payload.successfulDeletions.push(...ids); | ||
sumSuccessful += ids.length; | ||
sumSuccessful += ids.length; | ||
} catch (deleteError) { | ||
@@ -100,11 +103,17 @@ var message = JSON.stringify(deleteError); | ||
}); | ||
node.warn(`Failed to delete some process instances for Model-ID: ${modelId}. Error: ${message}`); | ||
node.warn( | ||
`Failed to delete some process instances for Model-ID: ${modelId}. Error: ${message}`, | ||
); | ||
} | ||
} | ||
node.log(`Successfully deleted ${sumSuccessful} process instances and ${sumFailed} failed to delete process instances for Model-ID: ${modelId}.`); | ||
node.log( | ||
`Successfully deleted ${sumSuccessful} process instances and ${sumFailed} failed to delete process instances for Model-ID: ${modelId}.`, | ||
); | ||
node.send(msg); | ||
} catch (queryError) { | ||
node.error(`Failed to query process instances for Model-ID: ${modelId}. Error: ${queryError.message}`, msg); | ||
node.error( | ||
`Failed to query process instances for Model-ID: ${modelId}. Error: ${queryError.message}`, | ||
msg, | ||
); | ||
} | ||
@@ -111,0 +120,0 @@ }); |
@@ -11,3 +11,3 @@ module.exports = function (RED) { | ||
const client = node.engine.engineClient; | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -21,3 +21,3 @@ | ||
client.processInstances | ||
.query(query, { identity: userIdentity }) | ||
.query(query, { identity: userIdentity }) | ||
.then((matchingInstances) => { | ||
@@ -24,0 +24,0 @@ msg.payload = matchingInstances; |
@@ -10,3 +10,3 @@ module.exports = function (RED) { | ||
const client = node.engine.engineClient; | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -23,3 +23,3 @@ | ||
payload: msg.payload, | ||
identity: userIdentity | ||
identity: userIdentity, | ||
}) | ||
@@ -26,0 +26,0 @@ .then((result) => { |
@@ -10,3 +10,3 @@ module.exports = function (RED) { | ||
const client = node.engine.engineClient; | ||
const isUser = !!msg._client?.user | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -22,3 +22,3 @@ | ||
client.userTasks | ||
.query(query, {identity: userIdentity}) | ||
.query(query, { identity: userIdentity }) | ||
.then((matchingFlowNodes) => { | ||
@@ -25,0 +25,0 @@ if (config.sendtype === 'array') { |
@@ -16,8 +16,9 @@ module.exports = function (RED) { | ||
node.engine = RED.nodes.getNode(config.engine); | ||
const client = node.engine.engineClient; | ||
const isUser = !!msg._client?.user | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser | ||
? { userId: msg._client.user.id, token: msg._client.user.accessToken } | ||
: null; | ||
@@ -24,0 +25,0 @@ if (!client) { |
@@ -7,4 +7,2 @@ module.exports = function (RED) { | ||
node.engine = RED.nodes.getNode(config.engine); | ||
const isUser = !!msg._client?.user | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
@@ -16,2 +14,4 @@ let subscription = null; | ||
const client = node.engine.engineClient; | ||
const isUser = !!msg._client?.user; | ||
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null; | ||
subscribe = async () => { | ||
@@ -25,28 +25,33 @@ if (!client) { | ||
subscription = await client.userTasks.onUserTaskWaiting(async (userTaskWaitingNotification) => { | ||
const newQuery = { | ||
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId, | ||
...query, | ||
}; | ||
subscription = await client.userTasks.onUserTaskWaiting( | ||
async (userTaskWaitingNotification) => { | ||
const newQuery = { | ||
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId, | ||
...query, | ||
}; | ||
try { | ||
const matchingFlowNodes = await client.userTasks.query(newQuery, {identity: userIdentity}); | ||
try { | ||
const matchingFlowNodes = await client.userTasks.query(newQuery, { | ||
identity: userIdentity, | ||
}); | ||
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) { | ||
// remove subscription | ||
client.userTasks.removeSubscription(subscription, userIdentity); | ||
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) { | ||
// remove subscription | ||
client.userTasks.removeSubscription(subscription, userIdentity); | ||
const userTask = matchingFlowNodes.userTasks[0]; | ||
const userTask = matchingFlowNodes.userTasks[0]; | ||
msg.payload = { userTask: userTask }; | ||
node.send(msg); | ||
} else { | ||
// nothing todo - wait for next notification | ||
msg.payload = { userTask: userTask }; | ||
node.send(msg); | ||
} else { | ||
// nothing todo - wait for next notification | ||
} | ||
} catch (error) { | ||
node.error(error, msg); | ||
} | ||
} catch (error) { | ||
node.error(error, msg); | ||
} | ||
},{ | ||
identity: userIdentity, | ||
}); | ||
}, | ||
{ | ||
identity: userIdentity, | ||
}, | ||
); | ||
@@ -63,3 +68,5 @@ node.log({ 'Handling old userTasks config.only_for_new': config.only_for_new }); | ||
try { | ||
const matchingFlowNodes = await client.userTasks.query(suspendedQuery, {identity: userIdentity}); | ||
const matchingFlowNodes = await client.userTasks.query(suspendedQuery, { | ||
identity: userIdentity, | ||
}); | ||
@@ -88,3 +95,3 @@ if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length >= 1) { | ||
if (client != null && subscription != null) { | ||
client.userTasks.removeSubscription(subscription, ); | ||
client.userTasks.removeSubscription(subscription); | ||
} | ||
@@ -91,0 +98,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
792142
1
16657