From e6ee55271488b56c184111dee2dc67b114f58fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BChler?= Date: Fri, 29 Apr 2016 10:14:31 +0200 Subject: [PATCH 1/4] update repo --- .gitignore | 34 ++------------ .npmignore | 21 ++++++++- .travis.yml | 10 +++- README.md | 8 +++- dist/ElasticLoader.d.ts | 11 ----- dist/ElasticLoader.js | 59 ----------------------- dist/ElasticLoader.js.map | 1 - dist/helpers/Buffer.d.ts | 17 ------- dist/helpers/Buffer.js | 96 -------------------------------------- dist/helpers/Buffer.js.map | 1 - dist/index.d.ts | 1 - dist/index.js | 4 -- dist/index.js.map | 1 - helpers/Buffer.ts | 2 - index.ts | 2 +- package.json | 22 +++++---- tsconfig.json | 6 +-- 17 files changed, 58 insertions(+), 238 deletions(-) delete mode 100644 dist/ElasticLoader.d.ts delete mode 100644 dist/ElasticLoader.js delete mode 100644 dist/ElasticLoader.js.map delete mode 100644 dist/helpers/Buffer.d.ts delete mode 100644 dist/helpers/Buffer.js delete mode 100644 dist/helpers/Buffer.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map diff --git a/.gitignore b/.gitignore index 5e89640..8765e0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,36 +1,12 @@ -build -typings +node_modules # Logs logs *.log npm-debug.log* -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul +# Typescript stuff +typings +build +docs coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -node_modules - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history \ No newline at end of file diff --git a/.npmignore b/.npmignore index 2f28e28..2476d0e 100644 --- a/.npmignore +++ b/.npmignore @@ -24,4 +24,23 @@ node_modules .npm # Optional REPL history -.node_repl_history \ No newline at end of file +.node_repl_history + + +# Typescript stuff +typings +build +docs +coverage + +# Files +*.ts +!*.d.ts +*.js.map +*.spec.js +*.spec.ts +*.spec.d.ts +*.spec.js.map + +.travis.yml +.testdata diff --git a/.travis.yml b/.travis.yml index b5dc9e1..29d18cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,11 @@ language: node_js node_js: - - "5" \ No newline at end of file +- '5' +- '4.2' + +script: npm run citest +after_script: npm install coveralls@^2.11.9 && cat ./coverage/lcov.info | coveralls + +before_deploy: +- npm run bootstrap +- tsc --outDir . \ No newline at end of file diff --git a/README.md b/README.md index 30534cc..5b058d4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ -# ElasticLoader [![Build Status](https://travis-ci.org/buehler/proc-that-elastic-loader.svg?branch=master)](https://travis-ci.org/buehler/proc-that-elastic-loader) -Loader for proc-that. Loads processed items into an elasticsearch index. +# ElasticLoader +Loader for `proc-that`. Loads processed items into an elasticsearch index. + +##### A bunch of badges + +[![Build Status](https://travis-ci.org/smartive/proc-that-elastic-loader.svg?maxAge=3600)](https://travis-ci.org/smartive/proc-that-elastic-loader) [![npm](https://img.shields.io/npm/v/proc-that-elastic-loader.svg?maxAge=3600)](https://www.npmjs.com/package/proc-that-elastic-loader) [![Coverage status](https://img.shields.io/coveralls/smartive/proc-that-elastic-loader.svg?maxAge=3600)](https://coveralls.io/github/smartive/proc-that-elastic-loader) [![license](https://img.shields.io/github/license/smartive/proc-that-elastic-loader.svg?maxAge=2592000)](https://github.com/smartive/proc-that-elastic-loader) ## Installation diff --git a/dist/ElasticLoader.d.ts b/dist/ElasticLoader.d.ts deleted file mode 100644 index fbe520e..0000000 --- a/dist/ElasticLoader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ILoad } from 'proc-that/dist/interfaces/ILoad'; -export declare class ElasticLoader implements ILoad { - private index; - private type; - private predicate; - private idSelector; - private esClient; - private buffer; - constructor(config: any, index: string, type: string, predicate?: (obj: any) => boolean, idSelector?: (obj: any) => any); - write(object: any): Promise; -} diff --git a/dist/ElasticLoader.js b/dist/ElasticLoader.js deleted file mode 100644 index 737b1e8..0000000 --- a/dist/ElasticLoader.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Buffer_1 = require('./helpers/Buffer'); -var Promise = require('es6-promise').Promise; -var elasticsearch = require('elasticsearch'); -var NoIdProvidedError = (function (_super) { - __extends(NoIdProvidedError, _super); - function NoIdProvidedError(object) { - _super.call(this, 'No id provided by object'); - this.object = object; - } - return NoIdProvidedError; -}(Error)); -var ElasticLoader = (function () { - function ElasticLoader(config, index, type, predicate, idSelector) { - if (predicate === void 0) { predicate = function (o) { return true; }; } - if (idSelector === void 0) { idSelector = function (o) { return o.id; }; } - this.index = index; - this.type = type; - this.predicate = predicate; - this.idSelector = idSelector; - this.buffer = new Buffer_1.Buffer(); - var esConfig = JSON.parse(JSON.stringify(config)); - if (!esConfig.requestTimeout) { - esConfig.requestTimeout = 1000 * 60 * 5; - } - this.esClient = new elasticsearch.Client(esConfig); - if (esConfig.maxSockets) { - this.buffer = new Buffer_1.Buffer(esConfig.maxSockets); - } - } - ElasticLoader.prototype.write = function (object) { - var _this = this; - if (!this.predicate(object)) { - return Promise.resolve(); - } - var id = this.idSelector(object); - if (id === null || id === undefined) { - return Promise.reject(new NoIdProvidedError(object)); - } - var promise = this.buffer - .read() - .then(function (obj) { return _this.esClient.index({ - index: _this.index, - type: _this.type, - id: id, - body: object - }); }); - this.buffer.write(object); - return promise; - }; - return ElasticLoader; -}()); -exports.ElasticLoader = ElasticLoader; -//# sourceMappingURL=ElasticLoader.js.map \ No newline at end of file diff --git a/dist/ElasticLoader.js.map b/dist/ElasticLoader.js.map deleted file mode 100644 index 6213411..0000000 --- a/dist/El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,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IAED,6BAAK,GAAL,UAAM,MAAU;QAAhB,iBAuBC;QAtBG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEjC,EAAE,CAAC,CAAC,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC;YAClC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM;aACpB,IAAI,EAAE;aACN,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,KAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC7B,KAAK,EAAE,KAAI,CAAC,KAAK;YACjB,IAAI,EAAE,KAAI,CAAC,IAAI;YACf,EAAE,EAAE,EAAE;YACN,IAAI,EAAE,MAAM;SACf,CAAC,EALW,CAKX,CAAC,CAAC;QAER,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE1B,MAAM,CAAC,OAAO,CAAC;IACnB,CAAC;IACL,oBAAC;AAAD,CAAC,AA1CD,IA0CC;AA1CY,qBAAa,gBA0CzB,CAAA"} \ No newline at end of file diff --git a/dist/helpers/Buffer.d.ts b/dist/helpers/Buffer.d.ts deleted file mode 100644 index ea3eb69..0000000 --- a/dist/helpers/Buffer.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { EventEmitter } from 'events'; -export declare class BufferSealedError extends Error { - constructor(); -} -export declare class Buffer extends EventEmitter { - private content; - private _size; - private _sealed; - constructor(initialSize?: number); - size: number; - isFull: boolean; - isEmpty: boolean; - sealed: boolean; - seal(): void; - read(): Promise; - write(object: T): Promise; -} diff --git a/dist/helpers/Buffer.js b/dist/helpers/Buffer.js deleted file mode 100644 index 0e1ca76..0000000 --- a/dist/helpers/Buffer.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var events_1 = require('events'); -var Promise = require('es6-promise').Promise; -var BufferSealedError = (function (_super) { - __extends(BufferSealedError, _super); - function BufferSealedError() { - _super.call(this, 'Buffer is sealed.'); - } - return BufferSealedError; -}(Error)); -exports.BufferSealedError = BufferSealedError; -var Buffer = (function (_super) { - __extends(Buffer, _super); - function Buffer(initialSize) { - if (initialSize === void 0) { initialSize = 10; } - _super.call(this); - this.content = []; - this._sealed = false; - this._size = initialSize; - } - Object.defineProperty(Buffer.prototype, "size", { - get: function () { - return this._size; - }, - set: function (value) { - this._size = value; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Buffer.prototype, "isFull", { - get: function () { - return this.content.length >= this._size; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Buffer.prototype, "isEmpty", { - get: function () { - return this.content.length === 0; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Buffer.prototype, "sealed", { - get: function () { - return this._sealed; - }, - enumerable: true, - configurable: true - }); - Buffer.prototype.seal = function () { - this._sealed = true; - if (this.isEmpty) { - this.emit('end'); - } - }; - Buffer.prototype.read = function () { - var _this = this; - if (!this.isEmpty) { - var content = this.content.shift(); - this.emit('release', content); - if (this.isEmpty) { - this.emit('empty'); - if (this.sealed) - this.emit('end'); - } - return Promise.resolve(content); - } - return new Promise(function (resolve) { - _this.once('write', function () { return resolve(_this.read()); }); - }); - }; - Buffer.prototype.write = function (object) { - var _this = this; - if (this.sealed) { - return Promise.reject(new BufferSealedError()); - } - if (!this.isFull) { - this.content.push(object); - this.emit('write', object); - return Promise.resolve(object); - } - return new Promise(function (resolve) { - _this.once('release', function () { return resolve(_this.write(object)); }); - }); - }; - return Buffer; -}(events_1.EventEmitter)); -exports.Buffer = Buffer; -//# sourceMappingURL=Buffer.js.map \ No newline at end of file diff --git a/dist/helpers/Buffer.js.map b/dist/helpers/Buffer.js.map deleted file mode 100644 index 14b77a5..0000000 --- a/dist/helpers/Buffer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Buffer.js","sourceRoot":"","sources":["../../helpers/Buffer.ts"],"names":[],"mappings":";;;;;;AAAA,uBAA2B,QAAQ,CAAC,CAAA;AAEpC,IAAI,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC;AAE7C;IAAuC,qCAAK;IACxC;QACI,kBAAM,mBAAmB,CAAC,CAAC;IAC/B,CAAC;IACL,wBAAC;AAAD,CAAC,AAJD,CAAuC,KAAK,GAI3C;AAJY,yBAAiB,oBAI7B,CAAA;AAED;IAA+B,0BAAY;IAKvC,gBAAY,WAAuB;QAAvB,2BAAuB,GAAvB,gBAAuB;QAC/B,iBAAO,CAAC;QALJ,YAAO,GAAO,EAAE,CAAC;QAEjB,YAAO,GAAW,KAAK,CAAC;QAI5B,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;IAC7B,CAAC;IAED,sBAAW,wBAAI;aAAf;YACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;aAED,UAAgB,KAAY;YACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACvB,CAAC;;;OAJA;IAMD,sBAAW,0BAAM;aAAjB;YACI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC;QAC7C,CAAC;;;OAAA;IAED,sBAAW,2BAAO;aAAlB;YACI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,K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,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC3B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,CAAC,IAAI,OAAO,CAAC,UAAA,OAAO;YACtB,KAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAM,OAAA,OAAO,CAAC,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAA3B,CAA2B,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACP,CAAC;IACL,aAAC;AAAD,CAAC,AAtED,CAA+B,qBAAY,GAsE1C;AAtEY,cAAM,SAsElB,CAAA"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 89d35dc..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { ElasticLoader } from './ElasticLoader'; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 1d636a9..0000000 --- a/dist/index.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -var ElasticLoader_1 = require('./ElasticLoader'); -exports.ElasticLoader = ElasticLoader_1.ElasticLoader; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index c662bdc..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,8BAA4B,iBAAiB,CAAC;AAAtC,sDAAsC"} \ No newline at end of file diff --git a/helpers/Buffer.ts b/helpers/Buffer.ts index 2014a56..caaa05b 100644 --- a/helpers/Buffer.ts +++ b/helpers/Buffer.ts @@ -1,7 +1,5 @@ import {EventEmitter} from 'events'; -let Promise = require('es6-promise').Promise; - export class BufferSealedError extends Error { constructor() { super('Buffer is sealed.'); diff --git a/index.ts b/index.ts index 71d213f..fb11a2c 100644 --- a/index.ts +++ b/index.ts @@ -1 +1 @@ -export {ElasticLoader} from './ElasticLoader'; \ No newline at end of file +export * from './ElasticLoader'; \ No newline at end of file diff --git a/package.json b/package.json index 351d074..f97ff5f 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,16 @@ { "name": "proc-that-elastic-loader", - "version": "0.3.1", + "version": "0.3.2", "description": "Loader for proc-that. Loads processed items into an elasticsearch index.", "main": "dist/index.js", "scripts": { "clean": "rimraf build", - "pretest": "npm install && typings install && npm run clean && tsc", + "bootstrap": "npm install && typings install", + "pretest": "npm run bootstrap && npm run clean && tsc", "test": "mocha --ui bdd --recursive ./build", - "develop": "npm run clean && tsc -w", - "build": "rimraf build dist && tsc --outDir dist -d && del './dist/**/*.spec*'" + "precitest": "npm run bootstrap && npm run clean && tsc", + "citest": "istanbul cover -x \"**/*.spec.*\" _mocha --report lcovonly -- --ui bdd --recursive ./build", + "develop": "npm run clean && tsc -w" }, "keywords": [ "etl", @@ -18,18 +20,23 @@ "elastic", "elasticsearch" ], + "engines": { + "node": ">=4.2" + }, "repository": { "type": "git", - "url": "git@github.com:buehler/proc-that-elastic-loader.git" + "url": "git@github.com:smartive/proc-that-elastic-loader.git" }, - "bugs": "https://github.com/buehler/proc-that-elastic-loader/issues", + "bugs": "https://github.com/smartive/proc-that-elastic-loader/issues", "author": "Christoph Bühler ", "license": "MIT", "devDependencies": { "chai": "^3.5.0", "chai-as-promised": "^5.3.0", "del-cli": "^0.2.0", + "istanbul": "^0.4.3", "mocha": "^2.4.5", + "mocha-lcov-reporter": "^1.2.0", "rimraf": "^2.5.2", "sinon": "^1.17.3", "sinon-chai": "^2.8.0", @@ -37,8 +44,7 @@ "typings": "^0.7.9" }, "dependencies": { - "proc-that": "^0.3.0", "elasticsearch": "^10.1.3", - "es6-promise": "^3.1.2" + "proc-that": "^0.3.2" } } diff --git a/tsconfig.json b/tsconfig.json index 1f102a4..57a4b95 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,14 +3,14 @@ "target": "es5", "module": "commonjs", "moduleResolution": "node", - "removeComments": true, + "removeComments": false, "outDir": "./build", - "sourceMap": true + "declaration": true, + "sourceMap": false }, "exclude": [ "node_modules", "build", - "dist", "typings/browser.d.ts", "typings/browser" ] From fbd430caf09ff2bfd2fe9549a6bc35c9d6af976a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BChler?= Date: Fri, 29 Apr 2016 10:16:44 +0200 Subject: [PATCH 2/4] add deployment --- .travis.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 29d18cf..0ad0061 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,13 @@ after_script: npm install coveralls@^2.11.9 && cat ./coverage/lcov.info | covera before_deploy: - npm run bootstrap -- tsc --outDir . \ No newline at end of file +- tsc --outDir . + +deploy: + provider: npm + email: christoph.buehler@bluewin.ch + api_key: + secure: NoAP3zXpaw7efTltwCT5v//pWSTsCk1pvMVR02gFimdOI4kc9yr45GUAemmMBKDMPyxqwS2rJHl1A6Wps+P6gz2oMAFyioiK5TZI0qQNTVu9ggD7d1hlCr5Is1WZckblU863YckES6u+HoO0eXFC3iGZnh+1BldbTPR1PA9LWFJPGsZzJsDQRpxOWY6TLKRPlE53QmdclcIc//o4vVCldrCAdKojGlOVKhc03IaWt4i+onCszP81rUYkTTPdE2ODwQZrlbn1D01ojPu8UvPM4REKB90P+C9J/9PL1LR95UjHNPr2+nsa5dmbI2IQhAEudvAKOyBJV27DfZ2AcNNQyXc1e3OnH7zhP3Y19rceTzk0DOXnXKrQbzZEZ9ICnPfxv5PaQ+vOFJB4XkyrrF7LBWqNMRiYywt+vCBRelU7RUepXtO5wcj4TJmXUyB2fESL4W90HtPh1AZNvRPL2dH2DZF3tE2XSnG0MSHbwcrO+9ZUFZ2xBxCNM4WW5VCzH5H9z+ieLYqQmDwjBCgQp52Nw5UnJSmHk72Tlbbzphg4e7e40xH00AIVfLQiBHzEMOyRfZbtvS7cI/1SSMpP/sU+9rFUl5GiavupPVbFnzDUNBltXOk6HSaFtlarafO2llUcAGgxRithYLpjGbD1/4ZU+5NyOR4AFBejj0oq1cDAn7Y= + on: + tags: true + repo: smartive/proc-that-elastic-loader From cf59db44742e1d8af34e12c30db9244f9020977d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BChler?= Date: Fri, 29 Apr 2016 10:17:45 +0200 Subject: [PATCH 3/4] change indexfile --- .npmignore | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.npmignore b/.npmignore index 2476d0e..ec45734 100644 --- a/.npmignore +++ b/.npmignore @@ -43,4 +43,3 @@ coverage *.spec.js.map .travis.yml -.testdata diff --git a/package.json b/package.json index f97ff5f..aa2d890 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "proc-that-elastic-loader", "version": "0.3.2", "description": "Loader for proc-that. Loads processed items into an elasticsearch index.", - "main": "dist/index.js", + "main": "index.js", "scripts": { "clean": "rimraf build", "bootstrap": "npm install && typings install", From 7e5ba3cf6c4b2d60dc471aa6760ba8922cc60af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BChler?= Date: Fri, 29 Apr 2016 10:22:29 +0200 Subject: [PATCH 4/4] remove es6-promise --- ElasticLoader.spec.ts | 2 -- ElasticLoader.ts | 3 +-- helpers/Buffer.spec.ts | 2 -- helpers/Buffer.ts | 24 ++++++++++++------------ 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/ElasticLoader.spec.ts b/ElasticLoader.spec.ts index cc7274a..221bb20 100644 --- a/ElasticLoader.spec.ts +++ b/ElasticLoader.spec.ts @@ -4,8 +4,6 @@ import sinon = require('sinon'); import sinonChai = require('sinon-chai'); import {ElasticLoader} from './ElasticLoader'; -let Promise = require('es6-promise').Promise; - let should = chai.should(); chai.use(asPromised); chai.use(sinonChai); diff --git a/ElasticLoader.ts b/ElasticLoader.ts index 5b6e175..219a34a 100644 --- a/ElasticLoader.ts +++ b/ElasticLoader.ts @@ -1,7 +1,6 @@ -import {ILoad} from 'proc-that/dist/interfaces/ILoad'; +import {ILoad} from 'proc-that'; import {Buffer} from './helpers/Buffer'; -let Promise = require('es6-promise').Promise; let elasticsearch = require('elasticsearch'); class NoIdProvidedError extends Error { diff --git a/helpers/Buffer.spec.ts b/helpers/Buffer.spec.ts index 139f323..d5e0e59 100644 --- a/helpers/Buffer.spec.ts +++ b/helpers/Buffer.spec.ts @@ -4,8 +4,6 @@ import sinon = require('sinon'); import sinonChai = require('sinon-chai'); import {Buffer} from './Buffer'; -let Promise = require('es6-promise').Promise; - let should = chai.should(); chai.use(asPromised); chai.use(sinonChai); diff --git a/helpers/Buffer.ts b/helpers/Buffer.ts index caaa05b..db7855e 100644 --- a/helpers/Buffer.ts +++ b/helpers/Buffer.ts @@ -7,43 +7,43 @@ export class BufferSealedError extends Error { } export class Buffer extends EventEmitter { - private content:T[] = []; - private _size:number; - private _sealed:boolean = false; + private content: T[] = []; + private _size: number; + private _sealed: boolean = false; - constructor(initialSize:number = 10) { + constructor(initialSize: number = 10) { super(); this._size = initialSize; } - public get size():number { + public get size(): number { return this._size; } - public set size(value:number) { + public set size(value: number) { this._size = value; } - public get isFull():boolean { + public get isFull(): boolean { return this.content.length >= this._size; } - public get isEmpty():boolean { + public get isEmpty(): boolean { return this.content.length === 0; } - public get sealed():boolean { + public get sealed(): boolean { return this._sealed; } - public seal():void { + public seal(): void { this._sealed = true; if (this.isEmpty) { this.emit('end'); } } - public read():Promise { + public read(): Promise { if (!this.isEmpty) { let content = this.content.shift(); this.emit('release', content); @@ -61,7 +61,7 @@ export class Buffer extends EventEmitter { }); } - public write(object:T):Promise { + public write(object: T): Promise | Promise { if (this.sealed) { return Promise.reject(new BufferSealedError()); }