@usebruno/js
Advanced tools
Comparing version 0.8.0 to 0.9.0
{ | ||
"name": "@usebruno/js", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -8,2 +8,3 @@ class BrunoRequest { | ||
this.body = req.data; | ||
this.timeout = req.timeout; | ||
} | ||
@@ -54,4 +55,12 @@ | ||
} | ||
getTimeout() { | ||
return this.req.timeout; | ||
} | ||
setTimeout(timeout) { | ||
this.req.timeout = timeout; | ||
} | ||
} | ||
module.exports = BrunoRequest; |
@@ -7,4 +7,6 @@ const _ = require('lodash'); | ||
const { evaluateJsTemplateLiteral, evaluateJsExpression, createResponseParser } = require('../utils'); | ||
const { interpolateString } = require('../interpolate-string'); | ||
const { expect } = chai; | ||
chai.use(require('chai-string')); | ||
chai.use(function (chai, utils) { | ||
@@ -164,2 +166,8 @@ // Custom assertion for checking if a variable is JSON | ||
const interpolationContext = { | ||
collectionVariables: context.bru.collectionVariables, | ||
envVariables: context.bru.envVariables, | ||
processEnvVars: context.bru.processEnvVars | ||
}; | ||
// gracefully allow both a,b as well as [a, b] | ||
@@ -171,7 +179,11 @@ if (operator === 'in' || operator === 'notIn') { | ||
return rhsOperand.split(',').map((v) => evaluateJsTemplateLiteral(v.trim(), context)); | ||
return rhsOperand | ||
.split(',') | ||
.map((v) => evaluateJsTemplateLiteral(interpolateString(v.trim(), interpolationContext), context)); | ||
} | ||
if (operator === 'between') { | ||
const [lhs, rhs] = rhsOperand.split(',').map((v) => evaluateJsTemplateLiteral(v.trim(), context)); | ||
const [lhs, rhs] = rhsOperand | ||
.split(',') | ||
.map((v) => evaluateJsTemplateLiteral(interpolateString(v.trim(), interpolationContext), context)); | ||
return [lhs, rhs]; | ||
@@ -186,6 +198,6 @@ } | ||
return rhsOperand; | ||
return interpolateString(rhsOperand, interpolationContext); | ||
} | ||
return evaluateJsTemplateLiteral(rhsOperand, context); | ||
return evaluateJsTemplateLiteral(interpolateString(rhsOperand, interpolationContext), context); | ||
}; | ||
@@ -275,3 +287,3 @@ | ||
case 'between': | ||
const [min, max] = value.split(','); | ||
const [min, max] = rhs; | ||
expect(lhs).to.be.within(min, max); | ||
@@ -278,0 +290,0 @@ break; |
@@ -18,2 +18,3 @@ const { NodeVM } = require('vm2'); | ||
// Inbuilt Library Support | ||
const ajv = require('ajv'); | ||
const atob = require('atob'); | ||
@@ -43,3 +44,3 @@ const btoa = require('btoa'); | ||
processEnvVars, | ||
scriptingConfig, | ||
scriptingConfig | ||
) { | ||
@@ -53,3 +54,3 @@ const bru = new Bru(envVariables, collectionVariables, processEnvVars, collectionPath); | ||
for(let module of moduleWhitelist) { | ||
for (let module of moduleWhitelist) { | ||
try { | ||
@@ -76,2 +77,3 @@ whitelistedModules[module] = require(module); | ||
log: customLogger('log'), | ||
debug: customLogger('debug'), | ||
info: customLogger('info'), | ||
@@ -100,2 +102,3 @@ warn: customLogger('warn'), | ||
// 3rd party libs | ||
ajv, | ||
atob, | ||
@@ -144,3 +147,3 @@ btoa, | ||
for(let module of moduleWhitelist) { | ||
for (let module of moduleWhitelist) { | ||
try { | ||
@@ -191,2 +194,3 @@ whitelistedModules[module] = require(module); | ||
// 3rd party libs | ||
ajv, | ||
atob, | ||
@@ -202,3 +206,3 @@ btoa, | ||
...whitelistedModules, | ||
fs: allowScriptFilesystemAccess ? fs : undefined, | ||
fs: allowScriptFilesystemAccess ? fs : undefined | ||
} | ||
@@ -205,0 +209,0 @@ } |
@@ -21,4 +21,4 @@ const { NodeVM } = require('vm2'); | ||
// Inbuilt Library Support | ||
const ajv = require('ajv'); | ||
const atob = require('atob'); | ||
const axios = require('axios'); | ||
const btoa = require('btoa'); | ||
@@ -29,2 +29,4 @@ const lodash = require('lodash'); | ||
const nanoid = require('nanoid'); | ||
const axios = require('axios'); | ||
const fetch = require('node-fetch'); | ||
const CryptoJS = require('crypto-js'); | ||
@@ -54,3 +56,3 @@ | ||
for(let module of moduleWhitelist) { | ||
for (let module of moduleWhitelist) { | ||
try { | ||
@@ -117,5 +119,5 @@ whitelistedModules[module] = require(module); | ||
// 3rd party libs | ||
ajv, | ||
btoa, | ||
atob, | ||
axios, | ||
btoa, | ||
lodash, | ||
@@ -125,3 +127,5 @@ moment, | ||
nanoid, | ||
axios, | ||
chai, | ||
'node-fetch': fetch, | ||
'crypto-js': CryptoJS, | ||
@@ -128,0 +132,0 @@ ...whitelistedModules, |
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
30965
15
1042
8