Socket
Socket
Sign inDemoInstall

node-wit

Package Overview
Dependencies
115
Maintainers
7
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 6.0.0

4

index.js
'use strict';
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*/
module.exports = {

@@ -4,0 +8,0 @@ log: require('./lib/log'),

7

lib/config.js
'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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc