@usebruno/js
Advanced tools
Comparing version 0.20.0 to 0.21.0
{ | ||
"name": "@usebruno/js", | ||
"version": "0.20.0", | ||
"version": "0.21.0", | ||
"license": "MIT", | ||
@@ -23,3 +23,3 @@ "main": "src/index.js", | ||
"atob": "^2.1.2", | ||
"axios": "^1.5.1", | ||
"axios": "1.7.5", | ||
"btoa": "^1.2.1", | ||
@@ -34,3 +34,3 @@ "chai": "^4.3.7", | ||
"nanoid": "3.3.4", | ||
"node-fetch": "^2.7.0", | ||
"node-fetch": "2.7.0", | ||
"node-vault": "^0.10.2", | ||
@@ -43,14 +43,8 @@ "path": "^0.12.7", | ||
"@rollup/plugin-commonjs": "^23.0.2", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"rollup": "3.2.5", | ||
"rollup-plugin-node-builtins": "^2.1.2", | ||
"rollup-plugin-node-globals": "^1.4.0", | ||
"rollup-plugin-polyfill-node": "^0.13.0", | ||
"rollup": "3.29.5", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"stream": "^0.0.2", | ||
"terser": "^5.31.1", | ||
"uglify-js": "^3.18.0", | ||
"util": "^0.12.5" | ||
} | ||
} |
const { marshallToVm } = require('../utils'); | ||
const addBrunoResponseShimToContext = (vm, res) => { | ||
const resObject = vm.newObject(); | ||
let resFn = vm.newFunction('res', function (exprStr) { | ||
return marshallToVm(res(vm.dump(exprStr)), vm); | ||
}); | ||
@@ -11,6 +13,6 @@ const status = marshallToVm(res?.status, vm); | ||
vm.setProp(resObject, 'status', status); | ||
vm.setProp(resObject, 'headers', headers); | ||
vm.setProp(resObject, 'body', body); | ||
vm.setProp(resObject, 'responseTime', responseTime); | ||
vm.setProp(resFn, 'status', status); | ||
vm.setProp(resFn, 'headers', headers); | ||
vm.setProp(resFn, 'body', body); | ||
vm.setProp(resFn, 'responseTime', responseTime); | ||
@@ -25,3 +27,3 @@ status.dispose(); | ||
}); | ||
vm.setProp(resObject, 'getStatus', getStatus); | ||
vm.setProp(resFn, 'getStatus', getStatus); | ||
getStatus.dispose(); | ||
@@ -32,3 +34,3 @@ | ||
}); | ||
vm.setProp(resObject, 'getHeader', getHeader); | ||
vm.setProp(resFn, 'getHeader', getHeader); | ||
getHeader.dispose(); | ||
@@ -39,3 +41,3 @@ | ||
}); | ||
vm.setProp(resObject, 'getHeaders', getHeaders); | ||
vm.setProp(resFn, 'getHeaders', getHeaders); | ||
getHeaders.dispose(); | ||
@@ -46,3 +48,3 @@ | ||
}); | ||
vm.setProp(resObject, 'getBody', getBody); | ||
vm.setProp(resFn, 'getBody', getBody); | ||
getBody.dispose(); | ||
@@ -53,9 +55,15 @@ | ||
}); | ||
vm.setProp(resObject, 'getResponseTime', getResponseTime); | ||
vm.setProp(resFn, 'getResponseTime', getResponseTime); | ||
getResponseTime.dispose(); | ||
vm.setProp(vm.global, 'res', resObject); | ||
resObject.dispose(); | ||
let setBody = vm.newFunction('setBody', function (data) { | ||
res.setBody(vm.dump(data)); | ||
}); | ||
vm.setProp(resFn, 'setBody', setBody); | ||
setBody.dispose(); | ||
vm.setProp(vm.global, 'res', resFn); | ||
resFn.dispose(); | ||
}; | ||
module.exports = addBrunoResponseShimToContext; |
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
6
3537
290634
+ Addedaxios@1.7.5(transitive)
- Removedaxios@1.7.9(transitive)
Updatedaxios@1.7.5
Updatednode-fetch@2.7.0