dobo 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
|
@@ -264,7 +264,7 @@ async function factory (pkgName) {
|
|
|
264
264
|
return matcher
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
buildQuery =
|
|
267
|
+
buildQuery = ({ filter, schema, options = {} } = {}) => {
|
|
268
268
|
const { trim, find, isString, isPlainObject } = this.lib._
|
|
269
269
|
let query = {}
|
|
270
270
|
if (isString(filter.query)) {
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ async function count (name, filter = {}, opts = {}) {
|
|
|
15
15
|
await this.modelExists(name, true)
|
|
16
16
|
const { handler, schema, driver } = await resolveMethod.call(this, name, 'record-count', options)
|
|
17
17
|
if (!schema.cacheable) noCache = true
|
|
18
|
-
filter.query =
|
|
18
|
+
filter.query = this.buildQuery({ filter, schema, options }) ?? {}
|
|
19
19
|
if (options.queryHandler) filter.query = await options.queryHandler.call(opts.req ? this.app[opts.req.ns] : this, filter.query, opts.req)
|
|
20
20
|
filter.match = this.buildMatch({ input: filter.match, schema, options }) ?? {}
|
|
21
21
|
if (!noHook) {
|
|
@@ -20,7 +20,7 @@ async function findOne (name, filter = {}, opts = {}) {
|
|
|
20
20
|
filter.page = 1
|
|
21
21
|
const { handler, schema, driver } = await resolveMethod.call(this, name, 'record-find', options)
|
|
22
22
|
if (!schema.cacheable) noCache = true
|
|
23
|
-
filter.query =
|
|
23
|
+
filter.query = this.buildQuery({ filter, schema, options }) ?? {}
|
|
24
24
|
if (options.queryHandler) filter.query = await options.queryHandler.call(opts.req ? this.app[opts.req.ns] : this, filter.query, opts.req)
|
|
25
25
|
filter.match = this.buildMatch({ input: filter.match, schema, options }) ?? {}
|
|
26
26
|
if (!noHook) {
|
|
@@ -18,7 +18,7 @@ async function find (name, filter = {}, opts = {}) {
|
|
|
18
18
|
await this.modelExists(name, true)
|
|
19
19
|
const { handler, schema, driver } = await resolveMethod.call(this, name, 'record-find', options)
|
|
20
20
|
if (!schema.cacheable) noCache = true
|
|
21
|
-
filter.query =
|
|
21
|
+
filter.query = this.buildQuery({ filter, schema, options }) ?? {}
|
|
22
22
|
if (options.queryHandler) filter.query = await options.queryHandler.call(opts.req ? this.app[opts.req.ns] : this, filter.query, opts.req)
|
|
23
23
|
filter.match = this.buildMatch({ input: filter.match, schema, options }) ?? {}
|
|
24
24
|
if (!noHook) {
|
|
@@ -10,7 +10,7 @@ async function aggregate (name, filter = {}, options = {}) {
|
|
|
10
10
|
await runHook(`${this.name}:beforeStatAggregate`, name, aggregate, filter, options)
|
|
11
11
|
await runHook(`${this.name}.${name}:beforeStatAggregate`, aggregate, filter, options)
|
|
12
12
|
}
|
|
13
|
-
filter.query =
|
|
13
|
+
filter.query = this.buildQuery({ filter, schema, options }) ?? {}
|
|
14
14
|
filter.match = this.buildMatch({ input: filter.match, schema, options }) ?? {}
|
|
15
15
|
const rec = await handler.call(this.app[driver.ns], { schema, filter, options })
|
|
16
16
|
if (!noHook) {
|
|
@@ -9,7 +9,7 @@ async function histogram (name, filter = {}, options = {}) {
|
|
|
9
9
|
if (!types.includes(type)) throw this.error('histogramTypeMusBe%s', join(types))
|
|
10
10
|
await this.modelExists(name, true)
|
|
11
11
|
const { handler, schema, driver } = await resolveMethod.call(this, name, 'stat-histogram', options)
|
|
12
|
-
filter.query =
|
|
12
|
+
filter.query = this.buildQuery({ filter, schema, options }) ?? {}
|
|
13
13
|
filter.match = this.buildMatch({ input: filter.match, schema, options }) ?? {}
|
|
14
14
|
if (!noHook) {
|
|
15
15
|
await runHook(`${this.name}:beforeStatHistogram`, name, type, filter, options)
|