@usebruno/js
Advanced tools
Comparing version 0.9.1 to 0.9.2
{ | ||
"name": "@usebruno/js", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"license": "MIT", | ||
@@ -20,3 +20,3 @@ "main": "src/index.js", | ||
"atob": "^2.1.2", | ||
"axios": "^0.26.0", | ||
"axios": "^1.5.1", | ||
"btoa": "^1.2.1", | ||
@@ -32,4 +32,5 @@ "chai": "^4.3.7", | ||
"node-fetch": "2.*", | ||
"uuid": "^9.0.0" | ||
"uuid": "^9.0.0", | ||
"node-vault": "^0.10.2" | ||
} | ||
} |
const Handlebars = require('handlebars'); | ||
const { cloneDeep } = require('lodash'); | ||
const envVariableNameRegex = /^(?!\d)[\w-]*$/; | ||
class Bru { | ||
@@ -62,2 +64,9 @@ constructor(envVariables, collectionVariables, processEnvVars, collectionPath) { | ||
if (envVariableNameRegex.test(key) === false) { | ||
throw new Error( | ||
`Variable name: "${key}" contains invalid characters!` + | ||
' Names must only contain alpha-numeric characters, "-", "_" and cannot start with a digit.' | ||
); | ||
} | ||
this.collectionVariables[key] = value; | ||
@@ -67,2 +76,9 @@ } | ||
getVar(key) { | ||
if (envVariableNameRegex.test(key) === false) { | ||
throw new Error( | ||
`Variable name: "${key}" contains invalid characters!` + | ||
' Names must only contain alpha-numeric characters and cannot start with a digit.' | ||
); | ||
} | ||
return this.collectionVariables[key]; | ||
@@ -69,0 +85,0 @@ } |
@@ -29,2 +29,3 @@ const { NodeVM } = require('vm2'); | ||
const CryptoJS = require('crypto-js'); | ||
const NodeVault = require('node-vault'); | ||
@@ -50,2 +51,7 @@ class ScriptRuntime { | ||
const moduleWhitelist = get(scriptingConfig, 'moduleWhitelist', []); | ||
const additionalContextRoots = get(scriptingConfig, 'additionalContextRoots', []); | ||
const additionalContextRootsAbsolute = lodash | ||
.chain(additionalContextRoots) | ||
.map((acr) => (acr.startsWith('/') ? acr : path.join(collectionPath, acr))) | ||
.value(); | ||
@@ -88,3 +94,3 @@ const whitelistedModules = {}; | ||
external: true, | ||
root: [collectionPath], | ||
root: [collectionPath, ...additionalContextRootsAbsolute], | ||
mock: { | ||
@@ -113,3 +119,4 @@ // node libs | ||
...whitelistedModules, | ||
fs: allowScriptFilesystemAccess ? fs : undefined | ||
fs: allowScriptFilesystemAccess ? fs : undefined, | ||
'node-vault': NodeVault | ||
} | ||
@@ -203,3 +210,4 @@ } | ||
...whitelistedModules, | ||
fs: allowScriptFilesystemAccess ? fs : undefined | ||
fs: allowScriptFilesystemAccess ? fs : undefined, | ||
'node-vault': NodeVault | ||
} | ||
@@ -206,0 +214,0 @@ } |
@@ -31,2 +31,3 @@ const { NodeVM } = require('vm2'); | ||
const CryptoJS = require('crypto-js'); | ||
const NodeVault = require('node-vault'); | ||
@@ -52,2 +53,7 @@ class TestRuntime { | ||
const moduleWhitelist = get(scriptingConfig, 'moduleWhitelist', []); | ||
const additionalContextRoots = get(scriptingConfig, 'additionalContextRoots', []); | ||
const additionalContextRootsAbsolute = lodash | ||
.chain(additionalContextRoots) | ||
.map((acr) => (acr.startsWith('/') ? acr : path.join(collectionPath, acr))) | ||
.value(); | ||
@@ -106,3 +112,3 @@ const whitelistedModules = {}; | ||
external: true, | ||
root: [collectionPath], | ||
root: [collectionPath, ...additionalContextRootsAbsolute], | ||
mock: { | ||
@@ -131,3 +137,4 @@ // node libs | ||
...whitelistedModules, | ||
fs: allowScriptFilesystemAccess ? fs : undefined | ||
fs: allowScriptFilesystemAccess ? fs : undefined, | ||
'node-vault': NodeVault | ||
} | ||
@@ -134,0 +141,0 @@ } |
32379
1070
17
+ Addednode-vault@^0.10.2
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedaxios@1.8.1(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbluebird@2.11.0(transitive)
+ Addedcall-bind-apply-helpers@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.34.0.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.3.0(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.1.3(transitive)
+ Addedmustache@4.2.0(transitive)
+ Addednode-vault@0.10.2(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpostman-request@2.88.1-postman.8-beta.1(transitive)
+ Addedpostman-url-encoder@1.0.1(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedpsl@1.15.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstream-length@1.0.2(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtv4@1.3.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)
- Removedaxios@0.26.1(transitive)
Updatedaxios@^1.5.1