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

microframework-elasticsearch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microframework-elasticsearch - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

ElasticSearchExports.d.ts

3

ElasticSearchExports.js

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

"use strict";
"use strict";
//# sourceMappingURL=ElasticSearchExports.js.map

@@ -0,109 +1,79 @@

"use strict";
/**
* Express module integration with microframework.
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
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; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var ElasticSearchModule = (function () {
function ElasticSearchModule() {
_classCallCheck(this, ElasticSearchModule);
}
_createClass(ElasticSearchModule, [{
key: 'getName',
// -------------------------------------------------------------------------
// Accessors
// -------------------------------------------------------------------------
ElasticSearchModule.prototype.getName = function () {
return "ElasticSearchModule";
};
ElasticSearchModule.prototype.getConfigurationName = function () {
return "elasticsearch";
};
ElasticSearchModule.prototype.isConfigurationRequired = function () {
return true;
};
ElasticSearchModule.prototype.getModuleExports = function () {
return {
client: this.client
};
};
ElasticSearchModule.prototype.init = function (options, configuration) {
this.options = options;
this.configuration = configuration;
};
ElasticSearchModule.prototype.onBootstrap = function () {
this.setupConnection();
return this.ping();
};
ElasticSearchModule.prototype.onShutdown = function () {
if (this._client)
this._client.close();
return Promise.resolve();
};
Object.defineProperty(ElasticSearchModule.prototype, "client", {
// -------------------------------------------------------------------------
// Accessors
// -------------------------------------------------------------------------
value: function getName() {
return 'ElasticSearchModule';
}
}, {
key: 'getConfigurationName',
value: function getConfigurationName() {
return 'elasticsearch';
}
}, {
key: 'isConfigurationRequired',
value: function isConfigurationRequired() {
return true;
}
}, {
key: 'getModuleExports',
value: function getModuleExports() {
return {
client: this.client
};
}
}, {
key: 'init',
value: function init(options, configuration) {
this.options = options;
this.configuration = configuration;
}
}, {
key: 'onBootstrap',
value: function onBootstrap() {
this.setupConnection();
return this.ping();
}
}, {
key: 'onShutdown',
value: function onShutdown() {
if (this._client) this._client.close();
return Promise.resolve();
}
// -------------------------------------------------------------------------
// Accessors
// -------------------------------------------------------------------------
/**
* Gets elastic search client instance.
*/
}, {
key: 'setupConnection',
// -------------------------------------------------------------------------
// Private Methods
// -------------------------------------------------------------------------
value: function setupConnection() {
var options = {
host: this.configuration.host
};
if (this.configuration.log) options.log = this.configuration.log;
var elasticsearch = require('elasticsearch');
this._client = new elasticsearch.Client(options);
}
}, {
key: 'ping',
value: function ping() {
var _this = this;
return new Promise(function (ok, fail) {
_this._client.ping(function (error) {
if (error) {
fail('elasticsearch cluster is down!');
} else {
ok();
}
});
get: function () {
return this._client;
},
enumerable: true,
configurable: true
});
// -------------------------------------------------------------------------
// Private Methods
// -------------------------------------------------------------------------
ElasticSearchModule.prototype.setupConnection = function () {
var options = {
host: this.configuration.host
};
if (this.configuration.log)
options.log = this.configuration.log;
var elasticsearch = require("elasticsearch");
this._client = new elasticsearch.Client(options);
};
ElasticSearchModule.prototype.ping = function () {
var _this = this;
return new Promise(function (ok, fail) {
_this._client.ping(function (error) {
if (error) {
fail("elasticsearch cluster is down!");
}
else {
ok();
}
});
}
}, {
key: 'client',
get: function get() {
return this._client;
}
}]);
});
};
return ElasticSearchModule;
})();
exports.ElasticSearchModule = ElasticSearchModule;
}());
exports.ElasticSearchModule = ElasticSearchModule;
//# sourceMappingURL=ElasticSearchModule.js.map

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

"use strict";
"use strict";
//# sourceMappingURL=ElasticSearchModuleConfig.js.map
{
"name": "microframework-elasticsearch",
"version": "0.0.2",
"private": false,
"version": "0.1.0",
"description": "Elastic search integration with microframework",

@@ -9,10 +10,10 @@ "license": "Apache-2.0",

"name": "Umed Khudoiberdiev",
"email": "zarrhost@gmail.com"
"email": "pleerock.me@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/PLEEROCK/microframework-elasticsearch.git"
"url": "https://github.com/pleerock/microframework-elasticsearch.git"
},
"bugs": {
"url": "https://github.com/PLEEROCK/microframework-elasticsearch/issues"
"url": "https://github.com/pleerock/microframework-elasticsearch/issues"
},

@@ -23,28 +24,24 @@ "tags": [

],
"typings": "./microframework-elasticsearch.d.ts",
"typescript": {
"definitions": [
"microframework-elasticsearch.d.ts"
]
},
"dependencies": {
"microframework": ">=0.1.7",
"microframework": "~0.4.0",
"elasticsearch": "*"
},
"devDependencies": {
"chai": "^3.4.1",
"chai-as-promised": "^5.2.0",
"del": "^2.0.2",
"dts-generator": "^1.5.0",
"fs": "0.0.2",
"gulp": "^3.9.0",
"gulp-babel": "^5.2.1",
"gulp-plumber": "^1.0.1",
"gulp-mocha": "^2.2.0",
"gulp-replace": "^0.5.4",
"gulp-shell": "^0.5.0",
"gulp-typescript": "^2.9.0",
"run-sequence": "^1.1.4",
"tsd": "^0.6.4",
"typescript": "^1.6.2"
},
"scripts": {
"postversion": "./node_modules/.bin/gulp package"
"gulp-tslint": "^4.3.1",
"gulpclass": "0.1.0",
"mocha": "^2.3.4",
"sinon": "^1.17.2",
"sinon-chai": "^2.8.0",
"tslint": "^3.3.0",
"tslint-stylish": "^2.1.0-beta",
"typescript": "^1.8.0",
"typings": "^0.6.6"
}
}
# ElasticSearch module for Microframework
Adds integration between [elastic search](https://github.com/elastic/elasticsearch-js) and
[microframework](https://github.com/PLEEROCK/microframework).
[microframework](https://github.com/pleerock/microframework).

@@ -14,4 +14,3 @@ ## Usage

```typescript
```javascript
import {MicroFrameworkBootstrapper} from "microframework/MicroFrameworkBootstrapper";

@@ -27,7 +26,12 @@ import {ElasticSearchModule} from "microframework-elasticsearch/ElasticSearchModule";

.catch(error => console.error('Error: ', error));
```
3. Now you can use [elastic search](https://github.com/elastic/elasticsearch-js) module in your microframework.
3. ES6 features are used, so you may want to install [es6-shim](https://github.com/paulmillr/es6-shim) too:
`npm install es6-shim --save`
you may need to `require("es6-shim");` in your app.
4. Now you can use [elastic search](https://github.com/elastic/elasticsearch-js) module in your microframework.
## Todos

@@ -34,0 +38,0 @@

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