@usebruno/js
Advanced tools
Comparing version 0.12.0 to 0.13.0
{ | ||
"name": "@usebruno/js", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -14,3 +14,4 @@ const Handlebars = require('handlebars'); | ||
historyLogger, | ||
setHtmlVisualizationString | ||
setHtmlVisualizationString, | ||
secretVariables | ||
) { | ||
@@ -20,2 +21,3 @@ this.envVariables = envVariables; | ||
this.processEnvVars = cloneDeep(processEnvVars || {}); | ||
this.secretVariables = cloneDeep(secretVariables || {}); | ||
this.collectionPath = collectionPath; | ||
@@ -117,4 +119,8 @@ this.historyLogger = historyLogger; | ||
} | ||
getSecretVar(key) { | ||
return this.secretVariables?.[`$secrets.${key}`]; | ||
} | ||
} | ||
module.exports = Bru; |
@@ -202,3 +202,12 @@ const _ = require('lodash'); | ||
class AssertRuntime { | ||
runAssertions(assertions, request, response, envVariables, collectionVariables, collectionPath, historyLogger) { | ||
runAssertions( | ||
assertions, | ||
request, | ||
response, | ||
envVariables, | ||
collectionVariables, | ||
collectionPath, | ||
historyLogger, | ||
secretVariables | ||
) { | ||
const enabledAssertions = _.filter(assertions, (a) => a.enabled); | ||
@@ -209,3 +218,11 @@ if (!enabledAssertions.length) { | ||
const bru = new Bru(envVariables, collectionVariables); | ||
const bru = new Bru( | ||
envVariables, | ||
collectionVariables, | ||
undefined, // processEnvVars, | ||
undefined, // collectionPath, | ||
undefined, // historyLogger, | ||
undefined, // setHtmlVisualizationString, | ||
secretVariables | ||
); | ||
const req = new BrunoRequest(request, historyLogger); | ||
@@ -212,0 +229,0 @@ const res = createResponseParser(response); |
@@ -30,3 +30,3 @@ const { NodeVM } = require('vm2'); | ||
const CryptoJS = require('crypto-js'); | ||
const NodeVault = require('node-vault'); | ||
const NodeSecrets = require('node-vault'); | ||
@@ -47,3 +47,4 @@ class ScriptRuntime { | ||
scriptingConfig, | ||
historyLogger | ||
historyLogger, | ||
secretVariables | ||
) { | ||
@@ -60,3 +61,4 @@ let htmlVisualizationString; | ||
historyLogger, | ||
setHtmlVisualizationString | ||
setHtmlVisualizationString, | ||
secretVariables | ||
); | ||
@@ -134,3 +136,3 @@ const req = new BrunoRequest(request, historyLogger); | ||
fs: allowScriptFilesystemAccess ? fs : undefined, | ||
'node-vault': NodeVault | ||
'node-vault': NodeSecrets | ||
} | ||
@@ -160,3 +162,4 @@ } | ||
scriptingConfig, | ||
historyLogger | ||
historyLogger, | ||
secretVariables | ||
) { | ||
@@ -173,3 +176,4 @@ let htmlVisualizationString; | ||
historyLogger, | ||
setHtmlVisualizationString | ||
setHtmlVisualizationString, | ||
secretVariables | ||
); | ||
@@ -242,3 +246,3 @@ const req = new BrunoRequest(request, historyLogger); | ||
fs: allowScriptFilesystemAccess ? fs : undefined, | ||
'node-vault': NodeVault | ||
'node-vault': NodeSecrets | ||
} | ||
@@ -245,0 +249,0 @@ } |
@@ -32,3 +32,3 @@ const { NodeVM } = require('vm2'); | ||
const CryptoJS = require('crypto-js'); | ||
const NodeVault = require('node-vault'); | ||
const NodeSecrets = require('node-vault'); | ||
@@ -48,5 +48,14 @@ class TestRuntime { | ||
scriptingConfig, | ||
historyLogger | ||
historyLogger, | ||
secretVariables | ||
) { | ||
const bru = new Bru(envVariables, collectionVariables, processEnvVars, collectionPath, historyLogger); | ||
const bru = new Bru( | ||
envVariables, | ||
collectionVariables, | ||
processEnvVars, | ||
collectionPath, | ||
historyLogger, | ||
undefined, // setHtmlVisualizationString | ||
secretVariables | ||
); | ||
const req = new BrunoRequest(request, historyLogger); | ||
@@ -140,3 +149,3 @@ const res = new BrunoResponse(response); | ||
fs: allowScriptFilesystemAccess ? fs : undefined, | ||
'node-vault': NodeVault | ||
'node-vault': NodeSecrets | ||
} | ||
@@ -143,0 +152,0 @@ } |
@@ -7,3 +7,12 @@ const _ = require('lodash'); | ||
class VarsRuntime { | ||
runPreRequestVars(vars, request, envVariables, collectionVariables, collectionPath, processEnvVars, historyLogger) { | ||
runPreRequestVars( | ||
vars, | ||
request, | ||
envVariables, | ||
collectionVariables, | ||
collectionPath, | ||
processEnvVars, | ||
historyLogger, | ||
secretVars = {} | ||
) { | ||
const enabledVars = _.filter(vars, (v) => v.enabled); | ||
@@ -14,3 +23,11 @@ if (!enabledVars.length) { | ||
const bru = new Bru(envVariables, collectionVariables, processEnvVars, null, historyLogger); | ||
const bru = new Bru( | ||
envVariables, | ||
collectionVariables, | ||
processEnvVars, | ||
null, | ||
historyLogger, | ||
undefined, // setHtmlVisualizationString | ||
secretVars | ||
); | ||
const req = new BrunoRequest(request, historyLogger); | ||
@@ -26,2 +43,3 @@ | ||
...collectionVariables, | ||
...secretVars, | ||
...bruContext | ||
@@ -48,3 +66,4 @@ }; | ||
processEnvVars, | ||
historyLogger | ||
historyLogger, | ||
secretVars = {} | ||
) { | ||
@@ -56,3 +75,11 @@ const enabledVars = _.filter(vars, (v) => v.enabled); | ||
const bru = new Bru(envVariables, collectionVariables, processEnvVars, null, historyLogger); | ||
const bru = new Bru( | ||
envVariables, | ||
collectionVariables, | ||
processEnvVars, | ||
null, | ||
historyLogger, | ||
undefined, // setHtmlVisualizationString | ||
secretVars | ||
); | ||
const req = new BrunoRequest(request, historyLogger); | ||
@@ -70,2 +97,3 @@ const res = createResponseParser(response); | ||
...collectionVariables, | ||
...secretVars, | ||
...bruContext | ||
@@ -72,0 +100,0 @@ }; |
37199
1272