microframework-elasticsearch
Advanced tools
Comparing version 0.0.2 to 0.1.0
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8921
12
39
16
138
1
+ Addedconfigurator.ts@0.2.0(transitive)
+ Addedfind-root@0.1.1(transitive)
+ Addedfs@0.0.2(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedmicroframework@0.4.0(transitive)
+ Addedpath@0.12.7(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedreflect-metadata@0.1.14(transitive)
+ Addedtypedi@0.2.0(transitive)
+ Addedutil@0.10.4(transitive)
- Removedapp-root-path@2.2.1(transitive)
- Removedmicroframework@0.6.4(transitive)
Updatedmicroframework@~0.4.0