Comparing version 0.10.3 to 0.10.4
@@ -5,2 +5,6 @@ # Changelog | ||
## v0.10.4 | ||
- Allow index pattern date separator to be customized | ||
## v0.10.3 | ||
@@ -7,0 +11,0 @@ |
@@ -8,2 +8,3 @@ 'use strict'; | ||
DEFAULT_SETTING_TIMEOUT: 10000, | ||
DEFAULT_SETTING_DATE_SEPARATOR: '-', | ||
DEFAULT_SETTING_INTERVAL: 'week', | ||
@@ -10,0 +11,0 @@ DEFAULT_SETTING_DOCTYPE: 'esqueue' |
@@ -18,2 +18,6 @@ 'use strict'; | ||
function indexTimestamp(intervalStr) { | ||
var separator = arguments.length <= 1 || arguments[1] === undefined ? '-' : arguments[1]; | ||
if (separator.match(/[a-z]/i)) throw new Error('Interval separator can not be a letter'); | ||
var index = intervals.indexOf(intervalStr); | ||
@@ -31,12 +35,12 @@ if (index === -1) throw new Error('Invalid index interval: ', intervalStr); | ||
case 'month': | ||
dateString = 'YYYY-MM'; | ||
dateString = 'YYYY' + separator + 'MM'; | ||
break; | ||
case 'hour': | ||
dateString = 'YYYY-MM-DD-HH'; | ||
dateString = 'YYYY' + separator + 'MM' + separator + 'DD' + separator + 'HH'; | ||
break; | ||
case 'minute': | ||
dateString = 'YYYY-MM-DD-HH-mm'; | ||
dateString = 'YYYY' + separator + 'MM' + separator + 'DD' + separator + 'HH' + separator + 'mm'; | ||
break; | ||
default: | ||
dateString = 'YYYY-MM-DD'; | ||
dateString = 'YYYY' + separator + 'MM' + separator + 'DD'; | ||
} | ||
@@ -43,0 +47,0 @@ |
@@ -67,3 +67,4 @@ 'use strict'; | ||
timeout: _constants2.default.DEFAULT_SETTING_TIMEOUT, | ||
doctype: _constants2.default.DEFAULT_SETTING_DOCTYPE | ||
doctype: _constants2.default.DEFAULT_SETTING_DOCTYPE, | ||
dateSeparator: _constants2.default.DEFAULT_SETTING_DATE_SEPARATOR | ||
}, (0, _lodash2.default)(options, ['client'])); | ||
@@ -94,3 +95,3 @@ _this.client = (0, _create_client2.default)(options.client || {}); | ||
var timestamp = (0, _index_timestamp2.default)(this.settings.interval); | ||
var timestamp = (0, _index_timestamp2.default)(this.settings.interval, this.settings.dateSeparator); | ||
var index = this.index + '-' + timestamp; | ||
@@ -97,0 +98,0 @@ var defaults = { |
{ | ||
"name": "esqueue", | ||
"version": "0.10.3", | ||
"version": "0.10.4", | ||
"description": "Job queue, powered by Elasticsearch", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
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
44747
771