node-wit
Advanced tools
Comparing version 5.0.0 to 6.0.0
'use strict'; | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
*/ | ||
module.exports = { | ||
@@ -4,0 +8,0 @@ log: require('./lib/log'), |
'use strict'; | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
*/ | ||
module.exports = { | ||
DEFAULT_API_VERSION: '20160516', | ||
DEFAULT_MAX_STEPS: 5, | ||
DEFAULT_API_VERSION: '20200513', | ||
DEFAULT_WIT_URL: 'https://api.wit.ai' | ||
}; |
@@ -0,6 +1,7 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
*/ | ||
'use strict'; | ||
var _require = require('./config'), | ||
DEFAULT_MAX_STEPS = _require.DEFAULT_MAX_STEPS; | ||
var logger = require('./log.js'); | ||
@@ -7,0 +8,0 @@ var readline = require('readline'); |
@@ -0,1 +1,5 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
*/ | ||
'use strict'; | ||
@@ -13,3 +17,3 @@ | ||
var levels = [DEBUG, INFO, WARN, ERROR]; | ||
var funcs = (_funcs = {}, _defineProperty(_funcs, DEBUG, console.error.bind(console, '[wit][debug]')), _defineProperty(_funcs, INFO, console.log.bind(console, '[wit]')), _defineProperty(_funcs, WARN, console.warn.bind(console, '[wit]')), _defineProperty(_funcs, ERROR, console.error.bind(console, '[wit]')), _funcs); | ||
var funcs = (_funcs = {}, _defineProperty(_funcs, DEBUG, console.debug.bind(console, '[wit][debug]')), _defineProperty(_funcs, INFO, console.log.bind(console, '[wit]')), _defineProperty(_funcs, WARN, console.warn.bind(console, '[wit]')), _defineProperty(_funcs, ERROR, console.error.bind(console, '[wit]')), _funcs); | ||
var noop = function noop() {}; | ||
@@ -16,0 +20,0 @@ |
@@ -0,1 +1,5 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
*/ | ||
'use strict'; | ||
@@ -7,3 +11,2 @@ | ||
DEFAULT_API_VERSION = _require.DEFAULT_API_VERSION, | ||
DEFAULT_MAX_STEPS = _require.DEFAULT_MAX_STEPS, | ||
DEFAULT_WIT_URL = _require.DEFAULT_WIT_URL; | ||
@@ -13,5 +16,19 @@ | ||
var log = require('./log'); | ||
var Url = require('url'); | ||
var HttpsProxyAgent = require('https-proxy-agent'); | ||
var learnMore = 'Learn more at https://wit.ai/docs/quickstart'; | ||
function getProxyAgent(witURL) { | ||
var url = Url.parse(witURL); | ||
var proxy = url.protocol === "http:" ? process.env.http_proxy || process.env.HTTP_PROXY : process.env.https_proxy || process.env.HTTPS_PROXY; | ||
var noProxy = process.env.no_proxy || process.env.NO_PROXY; | ||
var shouldIgnore = noProxy && noProxy.indexOf(url.hostname) > -1; | ||
if (proxy && !shouldIgnore) { | ||
return new HttpsProxyAgent(proxy); | ||
} | ||
if (!proxy) return null; | ||
} | ||
function Wit(opts) { | ||
@@ -27,3 +44,4 @@ if (!(this instanceof Wit)) { | ||
logger = _config.logger, | ||
witURL = _config.witURL; | ||
witURL = _config.witURL, | ||
proxy = _config.proxy; | ||
@@ -52,3 +70,4 @@ this._sessions = {}; | ||
method: method, | ||
headers: headers | ||
headers: headers, | ||
proxy: proxy | ||
}).then(function (response) { | ||
@@ -102,2 +121,3 @@ return Promise.all([response.json(), response.status]); | ||
opts.logger = opts.logger || new log.Logger(log.INFO); | ||
opts.proxy = getProxyAgent(opts.witURL); | ||
@@ -104,0 +124,0 @@ return opts; |
{ | ||
"name": "node-wit", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Wit.ai Node.js SDK", | ||
@@ -23,5 +23,7 @@ "keywords": [ | ||
"express": "^4.16.2", | ||
"https-proxy-agent": "^2.2.3", | ||
"isomorphic-fetch": "^2.2.1", | ||
"request": "^2.83.0", | ||
"uuid": "^3.0.0" | ||
"uuid": "^3.0.0", | ||
"lodash": "^4.17.14" | ||
}, | ||
@@ -28,0 +30,0 @@ "engines": { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
7274
173
2
7
7
+ Addedhttps-proxy-agent@^2.2.3
+ Addedlodash@^4.17.14
+ Addedagent-base@4.3.0(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addedes6-promise@4.2.8(transitive)
+ Addedes6-promisify@5.0.0(transitive)
+ Addedhttps-proxy-agent@2.2.4(transitive)
+ Addedlodash@4.17.21(transitive)