Socket
Socket
Sign inDemoInstall

@node-red/runtime

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@node-red/runtime - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

105

lib/nodes/context/index.js

@@ -423,2 +423,10 @@ /**

value: function(key, storage, callback) {
if (!callback && typeof storage === 'function') {
callback = storage;
storage = undefined;
}
if (callback) {
callback()
return;
}
return undefined;

@@ -429,2 +437,10 @@ }

value: function(key, value, storage, callback) {
if (!callback && typeof storage === 'function') {
callback = storage;
storage = undefined;
}
if (callback) {
callback()
return
}
}

@@ -434,2 +450,10 @@ },

value: function(storage, callback) {
if (!callback && typeof storage === 'function') {
callback = storage;
storage = undefined;
}
if (callback) {
callback();
return;
}
return undefined;

@@ -442,6 +466,28 @@ }

function getContext(localId,flowId,parent) {
var contextId = localId;
/**
* Get a flow-level context object.
* @param {string} flowId [description]
* @param {string} parentFlowId the id of the parent flow. undefined
* @return {object}} the context object
*/
function getFlowContext(flowId,parentFlowId) {
if (contexts.hasOwnProperty(flowId)) {
return contexts[flowId];
}
var parentContext = contexts[parentFlowId];
if (!parentContext) {
parentContext = createRootContext();
contexts[parentFlowId] = parentContext;
// throw new Error("Flow "+flowId+" is missing parent context "+parentFlowId);
}
var newContext = createContext(flowId,undefined,parentContext);
contexts[flowId] = newContext;
return newContext;
}
function getContext(nodeId, flowId) {
var contextId = nodeId;
if (flowId) {
contextId = localId+":"+flowId;
contextId = nodeId+":"+flowId;
}

@@ -451,13 +497,14 @@ if (contexts.hasOwnProperty(contextId)) {

}
var newContext = createContext(contextId,undefined,parent);
var newContext = createContext(contextId);
if (flowId) {
var node = flows.get(flowId);
var parent = undefined;
if (node && node.type.startsWith("subflow:")) {
parent = node.context().flow;
var flowContext = contexts[flowId];
if (!flowContext) {
// This is most likely due to a unit test for a node which doesn't
// initialise the flow properly.
// To keep things working, initialise the missing context.
// This *does not happen* in normal node-red operation
flowContext = createContext(flowId,undefined,createRootContext());
contexts[flowId] = flowContext;
}
else {
parent = createRootContext();
}
var flowContext = getContext(flowId,undefined,parent);
Object.defineProperty(newContext, 'flow', {

@@ -474,2 +521,35 @@ value: flowContext

//
// function getContext(localId,flowId,parent) {
// var contextId = localId;
// if (flowId) {
// contextId = localId+":"+flowId;
// }
// console.log("getContext",localId,flowId,"known?",contexts.hasOwnProperty(contextId));
// if (contexts.hasOwnProperty(contextId)) {
// return contexts[contextId];
// }
// var newContext = createContext(contextId,undefined,parent);
// if (flowId) {
// var node = flows.get(flowId);
// console.log("flows,get",flowId,node&&node.type)
// var parent = undefined;
// if (node && node.type.startsWith("subflow:")) {
// parent = node.context().flow;
// }
// else {
// parent = createRootContext();
// }
// var flowContext = getContext(flowId,undefined,parent);
// Object.defineProperty(newContext, 'flow', {
// value: flowContext
// });
// }
// Object.defineProperty(newContext, 'global', {
// value: contexts['global']
// })
// contexts[contextId] = newContext;
// return newContext;
// }
function deleteContext(id,flowId) {

@@ -526,2 +606,3 @@ if(!hasConfiguredStore){

get: getContext,
getFlowContext:getFlowContext,
delete: deleteContext,

@@ -528,0 +609,0 @@ clean: clean,

6

lib/nodes/context/localfilesystem.js

@@ -206,6 +206,6 @@ /**

var storagePath = getStoragePath(self.storageBaseDir,scope);
var context = newContext[scope];
var context = newContext[scope] || {};
var stringifiedContext = stringify(context);
if (stringifiedContext.circular && !self.knownCircularRefs[scope]) {
log.warn(log._("error-circular",{scope:scope}));
log.warn(log._("context.localfilesystem.error-circular",{scope:scope}));
self.knownCircularRefs[scope] = true;

@@ -328,3 +328,3 @@ } else {

if (stringifiedContext.circular && !self.knownCircularRefs[scope]) {
log.warn(log._("error-circular",{scope:scope}));
log.warn(log._("context.localfilesystem.error-circular",{scope:scope}));
self.knownCircularRefs[scope] = true;

@@ -331,0 +331,0 @@ } else {

@@ -21,2 +21,3 @@ /**

var events = require("../../events");
const context = require('../context');

@@ -58,2 +59,4 @@ var Subflow;

this.path = this.id;
// Ensure a context exists for this flow
this.context = context.getFlowContext(this.id,this.parent.id);
}

@@ -573,4 +576,5 @@

const closePromise = node.close(removed);
let closeTimer = null;
const closeTimeout = new Promise((resolve,reject) => {
setTimeout(() => {
closeTimer = setTimeout(() => {
reject("Close timed out");

@@ -580,5 +584,7 @@ }, nodeCloseTimeout);

return Promise.race([closePromise,closeTimeout]).then(() => {
clearTimeout(closeTimer);
var delta = Date.now() - start;
Log.trace("Stopped node "+node.type+":"+node.id+" ("+delta+"ms)" );
}).catch(err => {
clearTimeout(closeTimer);
node.error(Log._("nodes.flows.stopping-error",{message:err}));

@@ -585,0 +591,0 @@ Log.debug(err.stack);

@@ -556,3 +556,3 @@ /**

}
if (flow.disabled) {
if (flow.hasOwnProperty('disabled')) {
result.disabled = flow.disabled;

@@ -559,0 +559,0 @@ }

@@ -19,3 +19,3 @@ /**

const Flow = require('./Flow').Flow;
const context = require('../context');
const util = require("util");

@@ -158,3 +158,3 @@

if (ui) {
env[e.name].ui = ui;
env[e.name].ui = ui;
}

@@ -232,3 +232,7 @@ });

this.node.status = status => this.parent.handleStatus(this.node,status);
// Create a context instance
// console.log("Node.context",this.type,"id:",this._alias||this.id,"z:",this.z)
this._context = context.get(this._alias||this.id,this.z);
this.node._updateWires = this.node.updateWires;

@@ -472,3 +476,3 @@

* - node.wires,
* - node.scope of Catch and Status nodes,
* - node.scope of Complete, Catch and Status nodes,
* - node.XYZ for any property where XYZ is recognised as an old property

@@ -496,3 +500,3 @@ * @param {[type]} nodes [description]

}
if ((node.type === 'catch' || node.type === 'status') && node.scope) {
if ((node.type === 'complete' || node.type === 'catch' || node.type === 'status') && node.scope) {
node.scope = node.scope.map(function(id) {

@@ -499,0 +503,0 @@ return nodeMap[id]?nodeMap[id].id:""

@@ -44,2 +44,5 @@ /**

err.code = "git_connection_failed";
} else if(/Host key verification failed/i.test(stderr)) {
// TODO: handle host key verification errors separately
err.code = "git_host_key_verification_failed";
} else if (/fatal: could not read/i.test(stderr)) {

@@ -52,5 +55,2 @@ // Username/Password

err.code = "git_auth_failed";
} else if(/Host key verification failed/i.test(stderr)) {
// TODO: handle host key verification errors separately
err.code = "git_auth_failed";
} else if (/commit your changes or stash/i.test(stderr)) {

@@ -57,0 +57,0 @@ err.code = "git_local_overwrite";

{
"name": "@node-red/runtime",
"version": "1.0.4",
"version": "1.0.5",
"license": "Apache-2.0",

@@ -19,4 +19,4 @@ "main": "./lib/index.js",

"dependencies": {
"@node-red/registry": "1.0.4",
"@node-red/util": "1.0.4",
"@node-red/registry": "1.0.5",
"@node-red/util": "1.0.5",
"clone": "2.1.2",

@@ -23,0 +23,0 @@ "express": "4.17.1",

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