@node-red/runtime
Advanced tools
Comparing version 1.2.0-beta.1 to 1.2.0
@@ -140,4 +140,3 @@ /** | ||
function writeFileAtomic(storagePath, content) { | ||
async function writeFileAtomic(storagePath, content) { | ||
// To protect against file corruption, write to a tmp file first and then | ||
@@ -147,6 +146,6 @@ // rename to the destination file | ||
let tmpFile = finalFile + "."+Date.now()+".tmp"; | ||
return fs.outputFile(tmpFile, content, "utf8").then(function() { | ||
return fs.rename(tmpFile,finalFile); | ||
}) | ||
await fs.outputFile(tmpFile, content, "utf8"); | ||
return fs.rename(tmpFile,finalFile); | ||
} | ||
function LocalFileSystem(config){ | ||
@@ -174,2 +173,3 @@ this.config = config; | ||
var promises = []; | ||
var contextFiles = []; | ||
return listFiles(self.storageBaseDir).then(function(files) { | ||
@@ -185,3 +185,5 @@ files.forEach(function(file) { | ||
} | ||
promises.push(loadFile(path.join(self.storageBaseDir,file))); | ||
let contextFile = path.join(self.storageBaseDir,file); | ||
contextFiles.push(contextFile) | ||
promises.push(loadFile(contextFile)); | ||
}) | ||
@@ -191,6 +193,11 @@ return Promise.all(promises); | ||
scopes.forEach(function(scope,i) { | ||
var data = res[i]?JSON.parse(res[i]):{}; | ||
Object.keys(data).forEach(function(key) { | ||
self.cache.set(scope,key,data[key]); | ||
}) | ||
try { | ||
var data = res[i]?JSON.parse(res[i]):{}; | ||
Object.keys(data).forEach(function(key) { | ||
self.cache.set(scope,key,data[key]); | ||
}) | ||
} catch(err) { | ||
let error = new Error(log._("context.localfilesystem.invalid-json",{file: contextFiles[i]})) | ||
throw error; | ||
} | ||
}); | ||
@@ -197,0 +204,0 @@ }).catch(function(err){ |
@@ -179,2 +179,3 @@ { | ||
"localfilesystem": { | ||
"invalid-json": "Invalid JSON in context file '__file__'", | ||
"error-circular": "Context __scope__ contains a circular reference that cannot be persisted", | ||
@@ -181,0 +182,0 @@ "error-write": "Error writing context: __message__" |
{ | ||
"name": "@node-red/runtime", | ||
"version": "1.2.0-beta.1", | ||
"version": "1.2.0", | ||
"license": "Apache-2.0", | ||
@@ -19,4 +19,4 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@node-red/registry": "1.2.0-beta.1", | ||
"@node-red/util": "1.2.0-beta.1", | ||
"@node-red/registry": "1.2.0", | ||
"@node-red/util": "1.2.0", | ||
"async-mutex": "0.2.4", | ||
@@ -23,0 +23,0 @@ "clone": "2.1.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
505138
12058
1
+ Added@node-red/registry@1.2.0(transitive)
+ Added@node-red/util@1.2.0(transitive)
+ Addeduglify-js@3.11.2(transitive)
- Removed@node-red/registry@1.2.0-beta.1(transitive)
- Removed@node-red/util@1.2.0-beta.1(transitive)
- Removeduglify-js@3.11.0(transitive)
Updated@node-red/registry@1.2.0
Updated@node-red/util@1.2.0