Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-aws-es

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-aws-es - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

2

connector.js

@@ -24,3 +24,3 @@ /**

// #10
if (protocol) endpoint.protocol = protocol;
if (protocol) endpoint.protocol = protocol.replace(/:?$/, ":");
if (port) endpoint.port = port;

@@ -27,0 +27,0 @@

@@ -1,2 +0,2 @@

let nodeMajor = process.version.match(/([0-9]+)\./)[1];
var nodeMajor = process.version.match(/([0-9]+)\./)[1];

@@ -3,0 +3,0 @@ if (nodeMajor < 4) {

'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _awsSdk = require('aws-sdk');

@@ -23,26 +53,20 @@

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
/**
* A connection handler for Amazon ES.
*
* Uses the aws-sdk to make signed requests to an Amazon ES endpoint.
*
* @param client {Client} - The Client that this class belongs to
* @param config {Object} - Configuration options
* @param [config.protocol=http:] {String} - The HTTP protocol that this connection will use, can be set to https:
* @class HttpConnector
*/
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
* A connection handler for Amazon ES.
*
* Uses the aws-sdk to make signed requests to an Amazon ES endpoint.
*
* @param client {Client} - The Client that this class belongs to
* @param config {Object} - Configuration options
* @param [config.protocol=http:] {String} - The HTTP protocol that this connection will use, can be set to https:
* @class HttpConnector
*/
var HttpAmazonESConnector = function (_HttpConnector) {
_inherits(HttpAmazonESConnector, _HttpConnector);
(0, _inherits3.default)(HttpAmazonESConnector, _HttpConnector);
function HttpAmazonESConnector(host, config) {
_classCallCheck(this, HttpAmazonESConnector);
(0, _classCallCheck3.default)(this, HttpAmazonESConnector);
var _this = _possibleConstructorReturn(this, (HttpAmazonESConnector.__proto__ || Object.getPrototypeOf(HttpAmazonESConnector)).call(this, host, config));
var _this = (0, _possibleConstructorReturn3.default)(this, (HttpAmazonESConnector.__proto__ || (0, _getPrototypeOf2.default)(HttpAmazonESConnector)).call(this, host, config));

@@ -55,3 +79,3 @@ var protocol = host.protocol,

// #10
if (protocol) endpoint.protocol = protocol;
if (protocol) endpoint.protocol = protocol.replace(/:?$/, ":");
if (port) endpoint.port = port;

@@ -64,8 +88,8 @@

_createClass(HttpAmazonESConnector, [{
(0, _createClass3.default)(HttpAmazonESConnector, [{
key: 'request',
value: function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(params, cb) {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(params, cb) {
var incoming, timeoutId, request, req, status, headers, log, response, AWS, reqParams, cleanUp, p, CREDS, signer, send;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -183,3 +207,3 @@ switch (_context.prev = _context.next) {

return new Promise(function (resolve, reject) {
return new _promise2.default(function (resolve, reject) {
AWS.config.getCredentials(function (err, creds) {

@@ -192,3 +216,2 @@ if (err) return reject(err);

}]);
return HttpAmazonESConnector;

@@ -195,0 +218,0 @@ }(_http2.default);

'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _awsSdk = require('aws-sdk');

@@ -23,26 +45,20 @@

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
/**
* A connection handler for Amazon ES.
*
* Uses the aws-sdk to make signed requests to an Amazon ES endpoint.
*
* @param client {Client} - The Client that this class belongs to
* @param config {Object} - Configuration options
* @param [config.protocol=http:] {String} - The HTTP protocol that this connection will use, can be set to https:
* @class HttpConnector
*/
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
* A connection handler for Amazon ES.
*
* Uses the aws-sdk to make signed requests to an Amazon ES endpoint.
*
* @param client {Client} - The Client that this class belongs to
* @param config {Object} - Configuration options
* @param [config.protocol=http:] {String} - The HTTP protocol that this connection will use, can be set to https:
* @class HttpConnector
*/
var HttpAmazonESConnector = function (_HttpConnector) {
_inherits(HttpAmazonESConnector, _HttpConnector);
(0, _inherits3.default)(HttpAmazonESConnector, _HttpConnector);
function HttpAmazonESConnector(host, config) {
_classCallCheck(this, HttpAmazonESConnector);
(0, _classCallCheck3.default)(this, HttpAmazonESConnector);
var _this = _possibleConstructorReturn(this, (HttpAmazonESConnector.__proto__ || Object.getPrototypeOf(HttpAmazonESConnector)).call(this, host, config));
var _this = (0, _possibleConstructorReturn3.default)(this, (HttpAmazonESConnector.__proto__ || Object.getPrototypeOf(HttpAmazonESConnector)).call(this, host, config));

@@ -55,3 +71,3 @@ var protocol = host.protocol,

// #10
if (protocol) endpoint.protocol = protocol;
if (protocol) endpoint.protocol = protocol.replace(/:?$/, ":");
if (port) endpoint.port = port;

@@ -64,8 +80,8 @@

_createClass(HttpAmazonESConnector, [{
(0, _createClass3.default)(HttpAmazonESConnector, [{
key: 'request',
value: function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(params, cb) {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(params, cb) {
var incoming, timeoutId, request, req, status, headers, log, response, AWS, reqParams, cleanUp, p, CREDS, signer, send;
return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -191,3 +207,2 @@ switch (_context.prev = _context.next) {

}]);
return HttpAmazonESConnector;

@@ -194,0 +209,0 @@ }(_http2.default);

@@ -41,3 +41,3 @@ 'use strict';

// #10
if (protocol) endpoint.protocol = protocol;
if (protocol) endpoint.protocol = protocol.replace(/:?$/, ":");
if (port) endpoint.port = port;

@@ -44,0 +44,0 @@

@@ -39,3 +39,3 @@ 'use strict';

// #10
if (protocol) endpoint.protocol = protocol;
if (protocol) endpoint.protocol = protocol.replace(/:?$/, ":");
if (port) endpoint.port = port;

@@ -42,0 +42,0 @@

{
"name": "http-aws-es",
"version": "2.0.3",
"version": "2.0.4",
"description": "Use the elasticsearch-js client with Amazon ES",

@@ -20,13 +20,17 @@ "repository": "https://github.com/TheDeveloper/http-aws-es",

"main": "index.js",
"dependencies": {
"babel-runtime": "^6.23.0"
},
"peerDependencies": {
"aws-sdk": "^2.73.0",
"elasticsearch": "^13.1.1"
"aws-sdk": "^2.83.0",
"elasticsearch": "^13.2.0"
},
"devDependencies": {
"aws-sdk": "^2.73.0",
"elasticsearch": "^13.1.1",
"aws-sdk": "^2.83.0",
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-preset-env": "^1.5.2",
"eslint": "^4.0.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"elasticsearch": "^13.2.0",
"eslint": "^4.2.0",
"minimist": "^1.2.0"

@@ -38,2 +42,6 @@ },

"test": "BABEL_ENV=node6 babel-node ./test/local",
"test-node8": "BABEL_ENV=node8 node ./test/local",
"test-node6": "BABEL_ENV=node6 node ./test/local",
"test-node4": "BABEL_ENV=node4 node ./test/local",
"test-legacy": "BABEL_ENV=legacy node ./test/local",
"build-node4": "BABEL_ENV=node4 babel ./connector.js -o ./node4.js",

@@ -40,0 +48,0 @@ "build-node6": "BABEL_ENV=node6 babel ./connector.js -o ./node6.js",

@@ -34,3 +34,3 @@ # Connection handler for Amazon ES [<img title="Version" src="https://img.shields.io/npm/v/http-aws-es.svg?style=flat-square" />](https://www.npmjs.org/package/http-aws-es)

```bash
npm run test -- --endpoint https://amazon-es-host.us-east-1.es.amazonaws.com:80 --region us-east-1
npm run test -- --endpoint https://amazon-es-host.us-east-1.es.amazonaws.com --region us-east-1
```
var argv = require('minimist')(process.argv.slice(2));
import AWS from 'aws-sdk';
var AWS = require('aws-sdk');
AWS.config.update({ region: argv.region });
const hosts = [ argv.endpoint ];
var hosts = [ argv.endpoint ];
var esOptions = {
hosts,
connectionClass: require('../connector'),
hosts: hosts,
connectionClass: require('../index'),
log: 'trace'

@@ -15,6 +15,9 @@ };

var es = require('elasticsearch').Client(esOptions);
async function start() {
let result = await es.cluster.health();
console.log(result);
process.exit();
function start() {
function cb(err, result) {
console.log(result);
process.exit();
}
es.cluster.health(cb);
}

@@ -21,0 +24,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc