Comparing version 7.11.2 to 7.11.3
@@ -68,3 +68,3 @@ 'use strict'; | ||
_refine(selection, options) { | ||
_refine(selection, options, fullTable) { | ||
@@ -75,8 +75,7 @@ if (options.sort || | ||
const sort = (options.sort ? (typeof options.sort === 'string' || Array.isArray(options.sort) ? { key: options.sort } | ||
: options.sort) | ||
: { key: this.primary, order: 'ascending' }); | ||
const order = (sort.order === 'descending' ? 'desc' : 'asc'); | ||
selection = selection.orderBy(RethinkDB[order](Criteria.row(sort.key))); | ||
const sort = (options.sort ? (typeof options.sort === 'string' || Array.isArray(options.sort) ? { key: options.sort } : options.sort) : { key: this.primary }); | ||
const descending = (sort.order === 'descending'); | ||
const key = (typeof sort.key === 'string' ? (!descending && sort.key === this.primary && fullTable ? { index: sort.key } : sort.key) : Criteria.row(sort.key)); | ||
const by = (descending ? RethinkDB.desc(key) : key); | ||
selection = selection.orderBy(by); | ||
} | ||
@@ -112,3 +111,3 @@ | ||
this._run(this._refine(selection, options), 'all', null, callback); | ||
this._run(this._refine(selection, options, true), 'all', null, callback); | ||
} | ||
@@ -152,3 +151,3 @@ | ||
if (!options.sort) { | ||
settings.sort = { key: this.primary, order: 'ascending' }; | ||
settings.sort = { key: this.primary }; | ||
} | ||
@@ -181,3 +180,3 @@ | ||
this._run(this._refine(selection, settings), action, diag, step); | ||
this._run(this._refine(selection, settings, action === 'all'), action, diag, step); | ||
}; | ||
@@ -184,0 +183,0 @@ |
{ | ||
"name": "penseur", | ||
"description": "Lightweight RethinkDB wrapper", | ||
"version": "7.11.2", | ||
"version": "7.11.3", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/penseur", |
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
73140