@jsreport/jsreport-scripts
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -6,2 +6,8 @@ const extend = require('node.extend.without.arrays') | ||
module.exports = async function executeScript (reporter, script, method, req, res) { | ||
let entityPath | ||
if (script._id) { | ||
entityPath = await reporter.folders.resolveEntityPath(script, 'scripts', req) | ||
entityPath = entityPath.substring(0, entityPath.lastIndexOf('/')) | ||
} | ||
const requestContextMetaConfig = reporter.getRequestContextMetaConfig() || {} | ||
@@ -47,2 +53,4 @@ | ||
const sandboxManager = {} | ||
const executionFn = async ({ topLevelFunctions, restore, context }) => { | ||
@@ -75,3 +83,3 @@ try { | ||
// and unwrap proxies and descriptors into new sandbox object | ||
const restoredSandbox = restore() | ||
const restoredSandbox = sandboxManager.restore() | ||
@@ -111,5 +119,7 @@ if ( | ||
return await reporter.runInSandbox({ | ||
manager: sandboxManager, | ||
context: initialContext, | ||
userCode: script.content, | ||
executionFn, | ||
currentPath: entityPath, | ||
propertiesConfig: Object.keys(requestContextMetaConfig).reduce((acu, prop) => { | ||
@@ -116,0 +126,0 @@ // configure properties inside the context of sandbox |
@@ -17,3 +17,3 @@ /*! | ||
reporter.beforeScriptListeners = reporter.createListenerCollection() | ||
reporter.beforeScriptListeners = reporter.createListenerCollection('Scripts@beforeScript') | ||
@@ -20,0 +20,0 @@ reporter.beforeRenderListeners.insert({ |
{ | ||
"name": "@jsreport/jsreport-scripts", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "jsreport extension capable of running custom javascript functions during the rendering process", | ||
@@ -32,6 +32,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@jsreport/jsreport-assets": "3.0.0", | ||
"@jsreport/jsreport-core": "3.0.0", | ||
"@jsreport/jsreport-assets": "3.0.1", | ||
"@jsreport/jsreport-core": "3.1.0", | ||
"@jsreport/jsreport-jsrender": "3.0.0", | ||
"@jsreport/studio-dev": "3.0.0", | ||
"@jsreport/studio-dev": "3.0.1", | ||
"bluebird": "3.7.2", | ||
@@ -38,0 +38,0 @@ "mocha": "5.2.0", |
@@ -10,4 +10,10 @@ # @jsreport/jsreport-scripts | ||
### 3.0.1 | ||
- use relative path to the currently evaluated entity (use script path as the current entity path) | ||
- fix performance issue in sandbox when using long buffers (don't use restore() of sandbox through a method attached to the sandbox) | ||
- refactor ListenerCollection usage for better stack traces | ||
### 3.0.0-beta.1 | ||
Adaptations for the v3 APIs |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
64469
922
19
0