Comparing version 0.5.9 to 0.5.10
@@ -62,3 +62,4 @@ /* eslint no-shadow: 0, no-param-reassign: 0 */ | ||
}; | ||
}, 'relation') | ||
}, 'relation'), | ||
index: _joi2['default'].object()['default']({}, 'index') | ||
}); | ||
@@ -70,2 +71,3 @@ | ||
var relations = _Joi$attempt.relations; | ||
var index = _Joi$attempt.index; | ||
@@ -78,2 +80,3 @@ // assert.equal(_.has(schema(), pk), true, `'${pk}' is not specified in schema`); | ||
this.relations = relations; | ||
this.index = index; | ||
} | ||
@@ -207,15 +210,14 @@ | ||
indexFields = [].concat(_toConsumableArray(this.metaFields('index')), _toConsumableArray(this.metaFields('unique'))); | ||
context$2$0.next = 3; | ||
return regeneratorRuntime.awrap(indexFields.reduce(function (promise, indexName) { | ||
return promise.then(function () { | ||
return _this.ensureIndex(connection, indexName); | ||
}); | ||
}, Promise.resolve())); | ||
if (!_lodash2['default'].isEmpty(indexFields)) { | ||
context$2$0.next = 3; | ||
break; | ||
} | ||
return context$2$0.abrupt('return'); | ||
case 3: | ||
context$2$0.next = 5; | ||
return regeneratorRuntime.awrap(indexFields.reduce(function (promise, key) { | ||
return regeneratorRuntime.awrap(_lodash2['default'].reduce(this.index, function (promise, option, indexName) { | ||
return promise.then(function () { | ||
return _this.ensureIndex(connection, key); | ||
return option === true ? _this.ensureIndex(connection, indexName) : _this.ensureIndex(connection, indexName, option); | ||
}); | ||
@@ -232,7 +234,7 @@ }, Promise.resolve())); | ||
key: 'ensureIndex', | ||
value: function ensureIndex(connection, field) { | ||
value: function ensureIndex(connection, indexName, option) { | ||
return regeneratorRuntime.async(function ensureIndex$(context$2$0) { | ||
while (1) switch (context$2$0.prev = context$2$0.next) { | ||
case 0: | ||
if (!(this.pk === field)) { | ||
if (!(this.pk === indexName)) { | ||
context$2$0.next = 2; | ||
@@ -246,7 +248,7 @@ break; | ||
context$2$0.next = 4; | ||
return regeneratorRuntime.awrap(_rethinkdb2['default'].branch(this.query().indexList().contains(field).not(), this.query().indexCreate(field), null).run(connection)); | ||
return regeneratorRuntime.awrap(_rethinkdb2['default'].branch(this.query().indexList().contains(indexName).not(), this.query().indexCreate(indexName, option), null).run(connection)); | ||
case 4: | ||
context$2$0.next = 6; | ||
return regeneratorRuntime.awrap(this.query().indexWait(field).run(connection)); | ||
return regeneratorRuntime.awrap(this.query().indexWait(indexName).run(connection)); | ||
@@ -253,0 +255,0 @@ case 6: |
{ | ||
"name": "nothinkdb", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"description": "Functional toolkit for rethinkdb", | ||
@@ -5,0 +5,0 @@ "main": "lib/nothinkdb.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
35146
733