New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@5minds/node-red-contrib-processcube

Package Overview
Dependencies
Maintainers
26
Versions
411
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@5minds/node-red-contrib-processcube - npm Package Compare versions

Comparing version 0.3.5-feature-65fd58-lx819m2o to 0.3.5-feature-6c9546-lxi4vloc

nodered/package.json

3

package.json
{
"name": "@5minds/node-red-contrib-processcube",
"version": "0.3.5-feature-65fd58-lx819m2o",
"version": "0.3.5-feature-6c9546-lxi4vloc",
"license": "MIT",

@@ -35,2 +35,3 @@ "description": "Node-RED nodes for ProcessCube",

"processStart": "process-start.js",
"UserTaskNewListener": "usertask-new-listener.js",
"UserTaskInput": "usertask-input.js",

@@ -37,0 +38,0 @@ "UserTaskOutput": "usertask-output.js",

@@ -14,21 +14,2 @@ const process = require('process');

function mapUserTaskToMsg(userTask) {
return userTask.userTaskConfig.formFields.map(field => {
switch (field.type) {
case 'string':
return { id: field.id, type: 'text', required: false, label: field.label, value: '', title: 'Some helpful text' };
case 'long':
return { id: field.id, type: 'number', required: true, label: field.label, title: 'Some helpful text' };
case 'date':
return { id: field.id, type: 'date', required: true, label: field.label, title: 'Some helpful text' };
case 'enum':
return { id: field.id, type: 'select', required: true, label: field.label, options: field.enumValues.map(v => ({ id: v.id, name: v.name })), title: 'Choose an option' };
case 'boolean':
return { id: field.id, type: 'checkbox', required: false, label: field.label, title: 'Check for Yes' };
default:
return { id: field.id, type: field.type, required: true, label: field.label, title: 'Additional Information Needed' };
}
});
}
module.exports = function(RED) {

@@ -60,28 +41,34 @@ function UserTaskInput(config) {

client.userTasks.onUserTaskWaiting((userTaskWaitingNotification) => {
console.log(`UserTask with id ${userTaskWaitingNotification.flowNodeInstanceId} is waiting.`);
node.on("close", async () => {
client.dispose();
client = null;
});
// Abschließend mit - client.userTasks.finishUserTask(waitingUserTask?.flowNodeInstanceId, sampleResult)
node.on('input', async function(msg) {
console.log(`UserTaskInput received message: ${JSON.stringify(msg.payload)}`);
// flowNodeInstanceId
// processModelName
// flowNodeId
let query = msg.payload;
query = {"flowNodeInstanceId":"1f7225f4-f3c0-4865-91ad-8c6c71d23c22"};
console.log(`UserTaskInput query: ${JSON.stringify(query)}`);
client.userTasks.query({
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
processModelId: userTaskWaitingNotification.processModelId,
flowNodeId: userTaskWaitingNotification.flowNodeId,
"flowNodeInstanceId" : "1f7225f4-f3c0-4865-91ad-8c6c71d23c22"
}).then((matchingFlowNodes) => {
if (matchingFlowNodes && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
userTask = matchingFlowNodes.userTasks[0];
let formFields = mapUserTaskToMsg(userTask);
console.log(`UserTaskInput query result: ${JSON.stringify(matchingFlowNodes)}`);
if (matchingFlowNodes && matchingFlowNodes.flowNodeInstances && matchingFlowNodes.flowNodeInstances.length == 1) {
userTask = matchingFlowNodes.flowNodeInstances[0];
let flowNodeInstanceId = { id: "_flowNodeInstanceId", type: "hidden", value: userTaskWaitingNotification.flowNodeInstanceId};
formFields.push(flowNodeInstanceId);
node.send({ payload: {formFields: formFields, userTask: userTask }});
node.send({ payload: {userTask: userTask } });
} else {
node.send({ payload: matchingFlowNodes });
}
if (config.multisend) {
//matchingFlowNodes.forEach((userTask) => {
// node.send({ payload: { userTask: userTask } });
//});
} else {
node.send({ payload: { userTasks: matchingFlowNodes } });
}
}
});

@@ -88,0 +75,0 @@ });

@@ -34,9 +34,14 @@ const process = require('process');

node.on('input', function(msg) {
console.log(`Try to finsih UserTask with id ${msg.payload._flowNodeInstanceId}.`);
if (msg.payload.userTask) {
console.log(`Try to finsih UserTask with id ${msg.payload.userTask.flowNodeInstanceId}.`);
const flowNodeInstanceId = msg.payload._flowNodeInstanceId;
const flowNodeInstanceId = msg.payload.userTask.flowNodeInstanceId;
const userTaskResult = msg.payload.formData || {};
client.userTasks.finishUserTask(flowNodeInstanceId, msg.payload).then(() => {
console.log(`UserTask with id ${flowNodeInstanceId} finished.`);
});
client.userTasks.finishUserTask(flowNodeInstanceId, userTaskResult).then(() => {
console.log(`UserTask with id ${flowNodeInstanceId} finished.`);
});
} else {
console.log(`No UserTask found in message: ${JSON.stringify(msg.payload)}`);
}
});

@@ -43,0 +48,0 @@ }

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc